日韩欧美自拍在线观看-欧美精品在线看片一区二区-高清性视频一区二区播放-欧美日韩女优制服另类-国产精品久久久久久av蜜臀-成人在线黄色av网站-肥臀熟妇一区二区三区-亚洲视频在线播放老色-在线成人激情自拍视频

Android應(yīng)用于探秘藍(lán)牙隱藏API

出處:QIANGJIAXI 發(fā)布于:2011-08-25 22:44:12

    Android一詞的本義指“機(jī)器人”,同時(shí)也是Google于2007年11月5日宣布的基于Linux平臺的開源手機(jī)操作系統(tǒng)的名稱,該平臺由操作系統(tǒng)、中間件、用戶界面和應(yīng)用軟件組成,號稱是為移動終端打造的真正開放和完整的移動軟件。目前,版本為Android 2.4 Gingerbread和Android 3.0 HONeycomb。

    Android是基于Linux開放性內(nèi)核的操作系統(tǒng),是Google公司在2007年11月5日公布的手機(jī)操作系統(tǒng)。早期由原名為"Android"的公司開發(fā),谷歌在2005年收購"Android.Inc"后,繼續(xù)進(jìn)行對Android系統(tǒng)開發(fā)運(yùn)營,它采用了軟件堆層的架構(gòu),主要分為三部分。底層Linux內(nèi)核只提供基本功能,其他的應(yīng)用軟件則由各公司自行開發(fā),部分程序以Java編寫。

    本文探討下藍(lán)牙方面的隱藏API。用過Android系統(tǒng)設(shè)置(SetTIng)的人都知道藍(lán)牙搜索之后可以建立配對和解除配對,但是這兩項(xiàng)功能的函數(shù)沒有在SDK中給出,那么如何去使用這兩項(xiàng)功能呢?本文利用JAVA的反射機(jī)制去調(diào)用這兩項(xiàng)功能對應(yīng)的函數(shù):createBond和removeBond,具體的發(fā)掘和實(shí)現(xiàn)步驟如下:

    1.使用Git工具platform/packages/apps/Settings.git,在Setting源碼中查找關(guān)于建立配對和解除配對的API,知道這兩個(gè)API的宿主(BluetoothDevice);

    2.使用反射機(jī)制對BluetoothDevice枚舉其所有方法和常量,看看是否存在:

    view plaincopy to clipboardprint?

    STatic public void printAllInform(Class clsShow) {

    try {

    // 取得所有方法

    Method[] hideMethod = clsShow.getMethods();

    int i = 0;

    for (; i < hideMethod.length; i++) {

    Log.e("method name", hideMethod[i].getName());

    }

    // 取得所有常量

    Field[] allFields = clsShow.getFields();

    for (i = 0; i < allFields.length; i++) {

    Log.e("Field name", allFields[i].getName());

    }

    } catch (SecurityException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (IllegalArgumentException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    static public void printAllInform(Class clsShow) {

    try {

    // 取得所有方法

    Method[] hideMethod = clsShow.getMethods();

    int i = 0;

    for (; i < hideMethod.length; i++) {

    Log.e("method name", hideMethod[i].getName());

    }

    // 取得所有常量

    Field[] allFields = clsShow.getFields();

    for (i = 0; i < allFields.length; i++) {

    Log.e("Field name", allFields[i].getName());

    }

    } catch (SecurityException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (IllegalArgumentException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    結(jié)果如下:

    11-29 09:19:12.012: method name(452): cancelBondProcess

    11-29 09:19:12.020: method name(452): cancelPairingUserInput

    11-29 09:19:12.020: method name(452): createBond

    11-29 09:19:12.020: method name(452): createInsecureRfcommSocket

    11-29 09:19:12.027: method name(452): createRfcommSocket

    11-29 09:19:12.027: method name(452): createRfcommSocketToServiceRecord

    11-29 09:19:12.027: method name(452): createScoSocket

    11-29 09:19:12.027: method name(452): describeContents

    11-29 09:19:12.035: method name(452): equals

    11-29 09:19:12.035: method name(452): fetchUuidsWithSdp

    11-29 09:19:12.035: method name(452): getAddress

    11-29 09:19:12.035: method name(452): getBluetoothClass

    11-29 09:19:12.043: method name(452): getBondState

    11-29 09:19:12.043: method name(452): getName

    11-29 09:19:12.043: method name(452): getServiceChannel

    11-29 09:19:12.043: method name(452): getTrustState

    11-29 09:19:12.043: method name(452): getUuids

    11-29 09:19:12.043: method name(452): hashCode

    11-29 09:19:12.043: method name(452): isBluetoothDock

    11-29 09:19:12.043: method name(452): removeBond

    11-29 09:19:12.043: method name(452): setPairingConfirmation

    11-29 09:19:12.043: method name(452): setPasskey

    11-29 09:19:12.043: method name(452): setPin

    11-29 09:19:12.043: method name(452): setTrust

    11-29 09:19:12.043: method name(452): toString

    11-29 09:19:12.043: method name(452): writeToParcel

    11-29 09:19:12.043: method name(452): convertPinToBytes

    11-29 09:19:12.043: method name(452): getClass

    11-29 09:19:12.043: method name(452): notify

    11-29 09:19:12.043: method name(452): notifyAll

    11-29 09:19:12.043: method name(452): wait

    11-29 09:19:12.051: method name(452): wait

    11-29 09:19:12.051: method name(452): wait

    3.如果枚舉發(fā)現(xiàn)API存在(SDK卻隱藏),則自己實(shí)現(xiàn)調(diào)用方法:

    view plaincopy to clipboardprint?

    /**

    * 與設(shè)備配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean createBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method createBondMethod = btClass.getMethod("createBond");

    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備解除配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean removeBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method removeBondMethod = btClass.getMethod("removeBond");

    Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean createBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method createBondMethod = btClass.getMethod("createBond");

    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備解除配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean removeBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method removeBondMethod = btClass.getMethod("removeBond");

    Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    PS:SDK之所以不給出隱藏的API肯定有其原因,也許是出于安全性或者是后續(xù)版本兼容性的考慮,因此不能保證隱藏API能在所有Android平臺上很好地運(yùn)行……

    本文程序運(yùn)行效果如下:

 

 

    main.xml源碼如下:

    view plaincopy to clipboardprint?

    android:orientation="vertical" android:layout_width="fill_parent"

    android:layout_height="fill_parent">

    android:layout_height="wrap_content" android:layout_width="fill_parent">

        
        


    android:layout_width="wrap_content" android:layout_height="wrap_content">

    android:layout_height="fill_parent">

    android:orientation="vertical" android:layout_width="fill_parent"

    android:layout_height="fill_parent">

    android:layout_height="wrap_content" android:layout_width="fill_parent">


  
  


 
    android:layout_width="wrap_content" android:layout_height="wrap_content">

    android:layout_height="fill_parent">

    工具類ClsUtils.java源碼如下:

    view plaincopy to clipboardprint?

    package com.testReflect;

    import java.lang.reflect.Field;

    import java.lang.reflect.Method;

    import android.bluetooth.BluetoothDevice;

    import android.util.Log;

    public class ClsUtils {

    本文探討下藍(lán)牙方面的隱藏API。用過Android系統(tǒng)設(shè)置(Setting)的人都知道藍(lán)牙搜索之后可以建立配對和解除配對,但是這兩項(xiàng)功能的函數(shù)沒有在SDK中給出,那么如何去使用這兩項(xiàng)功能呢?本文利用JAVA的反射機(jī)制去調(diào)用這兩項(xiàng)功能對應(yīng)的函數(shù):createBond和removeBond,具體的發(fā)掘和實(shí)現(xiàn)步驟如下:

    1.使用Git工具platform/packages/apps/Settings.git,在Setting源碼中查找關(guān)于建立配對和解除配對的API,知道這兩個(gè)API的宿主(BluetoothDevice);

    2.使用反射機(jī)制對BluetoothDevice枚舉其所有方法和常量,看看是否存在:

    view plaincopy to clipboardprint?

    static public void printAllInform(Class clsShow) {

    try {

    // 取得所有方法

    Method[] hideMethod = clsShow.getMethods();

    int i = 0;

    for (; i < hideMethod.length; i++) {

    Log.e("method name", hideMethod[i].getName());

    }

    // 取得所有常量

    Field[] allFields = clsShow.getFields();

    for (i = 0; i < allFields.length; i++) {

    Log.e("Field name", allFields[i].getName());

    }

    } catch (SecurityException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (IllegalArgumentException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    static public void printAllInform(Class clsShow) {

    try {

    // 取得所有方法

    Method[] hideMethod = clsShow.getMethods();

    int i = 0;

    for (; i < hideMethod.length; i++) {

    Log.e("method name", hideMethod[i].getName());

    }

    // 取得所有常量

    Field[] allFields = clsShow.getFields();

    for (i = 0; i < allFields.length; i++) {

    Log.e("Field name", allFields[i].getName());

    }

    } catch (SecurityException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (IllegalArgumentException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    結(jié)果如下:

    11-29 09:19:12.012: method name(452): cancelBondProcess

    11-29 09:19:12.020: method name(452): cancelPairingUserInput

    11-29 09:19:12.020: method name(452): createBond

    11-29 09:19:12.020: method name(452): createInsecureRfcommSocket

    11-29 09:19:12.027: method name(452): createRfcommSocket

    11-29 09:19:12.027: method name(452): createRfcommSocketToServiceRecord

    11-29 09:19:12.027: method name(452): createScoSocket

    11-29 09:19:12.027: method name(452): describeContents

    11-29 09:19:12.035: method name(452): equals

    11-29 09:19:12.035: method name(452): fetchUuidsWithSdp

    11-29 09:19:12.035: method name(452): getAddress

    11-29 09:19:12.035: method name(452): getBluetoothClass

    11-29 09:19:12.043: method name(452): getBondState

    11-29 09:19:12.043: method name(452): getName

    11-29 09:19:12.043: method name(452): getServiceChannel

    11-29 09:19:12.043: method name(452): getTrustState

    11-29 09:19:12.043: method name(452): getUuids

    11-29 09:19:12.043: method name(452): hashCode

    11-29 09:19:12.043: method name(452): isBluetoothDock

    11-29 09:19:12.043: method name(452): removeBond

    11-29 09:19:12.043: method name(452): setPairingConfirmation

    11-29 09:19:12.043: method name(452): setPasskey

    11-29 09:19:12.043: method name(452): setPin

    11-29 09:19:12.043: method name(452): setTrust

    11-29 09:19:12.043: method name(452): toString

    11-29 09:19:12.043: method name(452): writeToParcel

    11-29 09:19:12.043: method name(452): convertPinToBytes

    11-29 09:19:12.043: method name(452): getClass

    11-29 09:19:12.043: method name(452): notify

    11-29 09:19:12.043: method name(452): notifyAll

    11-29 09:19:12.043: method name(452): wait

    11-29 09:19:12.051: method name(452): wait

    11-29 09:19:12.051: method name(452): wait

    3.如果枚舉發(fā)現(xiàn)API存在(SDK卻隱藏),則自己實(shí)現(xiàn)調(diào)用方法:

    view plaincopy to clipboardprint?

    /**

    * 與設(shè)備配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean createBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method createBondMethod = btClass.getMethod("createBond");

    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備解除配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean removeBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method removeBondMethod = btClass.getMethod("removeBond");

    Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean createBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method createBondMethod = btClass.getMethod("createBond");

    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備解除配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean removeBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method removeBondMethod = btClass.getMethod("removeBond");

    Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    PS:SDK之所以不給出隱藏的API肯定有其原因,也許是出于安全性或者是后續(xù)版本兼容性的考慮,因此不能保證隱藏API能在所有Android平臺上很好地運(yùn)行……

    本文程序運(yùn)行效果如下:

    main.xml源碼如下:

    view plaincopy to clipboardprint?

    android:orientation="vertical" android:layout_width="fill_parent"

    android:layout_height="fill_parent">

    android:layout_height="wrap_content" android:layout_width="fill_parent">

 


        
        


     
     android:layout_width="wrap_content" android:layout_height="wrap_content">

    android:layout_height="fill_parent">

    android:orientation="vertical" android:layout_width="fill_parent"

    android:layout_height="fill_parent">

    android:layout_height="wrap_content" android:layout_width="fill_parent">

  
  


 
    android:layout_width="wrap_content" android:layout_height="wrap_content">

    android:layout_height="fill_parent">

    工具類ClsUtils.java源碼如下:

    view plaincopy to clipboardprint?

    package com.testReflect;

    import java.lang.reflect.Field;

    import java.lang.reflect.Method;

    import android.bluetooth.BluetoothDevice;

    import android.util.Log;

    public class ClsUtils {

    /**

    * 與設(shè)備配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean createBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method createBondMethod = btClass.getMethod("createBond");

    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備解除配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean removeBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method removeBondMethod = btClass.getMethod("removeBond");

    Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    *

    * @param clsShow

    */

    static public void printAllInform(Class clsShow) {

    try {

    // 取得所有方法

    Method[] hideMethod = clsShow.getMethods();

    int i = 0;

    for (; i < hideMethod.length; i++) {

    Log.e("method name", hideMethod[i].getName());

    }

    // 取得所有常量

    Field[] allFields = clsShow.getFields();

    for (i = 0; i < allFields.length; i++) {

    Log.e("Field name", allFields[i].getName());

    }

    } catch (SecurityException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (IllegalArgumentException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    }

    package com.testReflect;

    import java.lang.reflect.Field;

    import java.lang.reflect.Method;

    import android.bluetooth.BluetoothDevice;

    import android.util.Log;

    public class ClsUtils {

    /**

    * 與設(shè)備配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean createBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method createBondMethod = btClass.getMethod("createBond");

    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    * 與設(shè)備解除配對 參考源碼:platform/packages/apps/Settings.git

    * \Settings\src\com\android\settings\bluetooth\CachedBluetoothDevice.java

    */

    static public boolean removeBond(Class btClass,BluetoothDevice btDevice) throws Exception {

    Method removeBondMethod = btClass.getMethod("removeBond");

    Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice);

    return returnValue.booleanValue();

    }

    /**

    *

    * @param clsShow

    */

    static public void printAllInform(Class clsShow) {

    try {

    // 取得所有方法

    Method[] hideMethod = clsShow.getMethods();

    int i = 0;

    for (; i < hideMethod.length; i++) {

    Log.e("method name", hideMethod[i].getName());

    }

    // 取得所有常量

    Field[] allFields = clsShow.getFields();

    for (i = 0; i < allFields.length; i++) {

    Log.e("Field name", allFields[i].getName());

    }

    } catch (SecurityException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (IllegalArgumentException e) {

    // throw new RuntimeException(e.getMessage());

    e.printStackTrace();

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    }

    主程序testReflect.java的源碼如下:

    view plaincopy to clipboardprint?

    package com.testReflect;

    import java.util.ArrayList;

    import java.util.List;

    import android.app.Activity;

    import android.bluetooth.BluetoothAdapter;

    import android.bluetooth.BluetoothDevice;

    import android.content.BroadcastReceiver;

    import android.content.Context;

    import android.content.Intent;

    import android.content.IntentFilter;

    import android.os.Bundle;

    import android.util.Log;

    import android.view.View;

    import android.widget.AdapterView;

    import android.widget.ArrayAdapter;

    import android.widget.Button;

    import android.widget.ListView;

    import android.widget.Toast;

    public class testReflect extends Activity {

    Button btnSearch, btnShow;

    ListView lvBTDevices;

    ArrayAdapter adtDevices;

    List lstDevices = new ArrayList();

    BluetoothDevice btDevice;

    BluetoothAdapter btAdapt;

    @Override

    public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    btnSearch = (Button) this.findViewById(R.id.btnSearch);

    btnSearch.setOnClickListener(new ClickEvent());

    btnShow = (Button) this.findViewById(R.id.btnShow);

    btnShow.setOnClickListener(new ClickEvent());

    lvBTDevices = (ListView) this.findViewById(R.id.ListView01);

    adtDevices = new ArrayAdapter(testReflect.this,

    android.R.layout.simple_list_item_1, lstDevices);

    lvBTDevices.setAdapter(adtDevices);

    lvBTDevices.setOnItemClickListener(new ItemClickEvent());

    btAdapt = BluetoothAdapter.getDefaultAdapter();// 初始化本機(jī)藍(lán)牙功能

    if (btAdapt.getState() == BluetoothAdapter.STATE_OFF)// 開藍(lán)牙

    btAdapt.enable();

    // 注冊Receiver來獲取藍(lán)牙設(shè)備相關(guān)的結(jié)果

    IntentFilter intent = new IntentFilter();

    intent.addAction(BluetoothDevice.ACTION_FOUND);

    intent.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);

    registerReceiver(searchDevices, intent);

    }

    private BroadcastReceiver searchDevices = new BroadcastReceiver() {

    public void onReceive(Context context, Intent intent) {

    String action = intent.getAction();

    Bundle b = intent.getExtras();

    Object[] lstName = b.keySet()。toArray();

    // 顯示所有收到的消息及其細(xì)節(jié)

    for (int i = 0; i < lstName.length; i++) {

    String keyName = lstName[i].toString();

    Log.e(keyName, String.valueOf(b.get(keyName)));

    }

    // 搜索設(shè)備時(shí),取得設(shè)備的MAC地址

    if (BluetoothDevice.ACTION_FOUND.equals(action)) {

    BluetoothDevice device = intent

    .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

    if (device.getBondState() == BluetoothDevice.BOND_NONE) {

    String str = "未配對|" + device.getName() + "|" + device.getAddress();

    lstDevices.add(str); // 獲取設(shè)備名稱和mac地址

    adtDevices.notifyDataSetChanged();

    }

    }

    }

    };

    class ItemClickEvent implements AdapterView.OnItemClickListener {

    @Override

    public void onItemClick(AdapterView arg0, View arg1, int arg2,

    long arg3) {

    btAdapt.cancelDiscovery();

    String str = lstDevices.get(arg2);

    String[] values = str.split("\\|");

    String address=values[2];

    btDevice = btAdapt.getRemoteDevice(address);

    try {

    if(values[0].equals("未配對"))

    {

    Toast.makeText(testReflect.this, "由未配對轉(zhuǎn)為已配對", 500)。show();

    ClsUtils.createBond(btDevice.getClass(), btDevice);

    }

    else if(values[0].equals("已配對"))

    {

    Toast.makeText(testReflect.this, "由已配對轉(zhuǎn)為未配對", 500)。show();

    ClsUtils.removeBond(btDevice.getClass(), btDevice);

    }

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    }

    /**

    * 按鍵處理

    * @author GV

    *

    */

    class ClickEvent implements View.OnClickListener {

    @Override

    public void onClick(View v) {

    if (v == btnSearch) {//搜索附近的藍(lán)牙設(shè)備

    lstDevices.clear();

    Object[] lstDevice = btAdapt.getBondedDevices()。toArray();

    for (int i = 0; i < lstDevice.length; i++) {

    BluetoothDevice device=(BluetoothDevice)lstDevice[i];

    String str = "已配對|" + device.getName() + "|" + device.getAddress();

    lstDevices.add(str); // 獲取設(shè)備名稱和mac地址

    adtDevices.notifyDataSetChanged();

    }

    // 開始搜索

    setTitle("本機(jī)藍(lán)牙地址:" + btAdapt.getAddress());

    btAdapt.startDiscovery();

    }

    else if(v==btnShow){//顯示BluetoothDevice的所有方法和常量,包括隱藏API

    ClsUtils.printAllInform(btDevice.getClass());

    }

    }

    }

    }


  
關(guān)鍵詞:Android藍(lán)牙

版權(quán)與免責(zé)聲明

凡本網(wǎng)注明“出處:維庫電子市場網(wǎng)”的所有作品,版權(quán)均屬于維庫電子市場網(wǎng),轉(zhuǎn)載請必須注明維庫電子市場網(wǎng),http://www.hbjingang.com,違反者本網(wǎng)將追究相關(guān)法律責(zé)任。

本網(wǎng)轉(zhuǎn)載并注明自其它出處的作品,目的在于傳遞更多信息,并不代表本網(wǎng)贊同其觀點(diǎn)或證實(shí)其內(nèi)容的真實(shí)性,不承擔(dān)此類作品侵權(quán)行為的直接責(zé)任及連帶責(zé)任。其他媒體、網(wǎng)站或個(gè)人從本網(wǎng)轉(zhuǎn)載時(shí),必須保留本網(wǎng)注明的作品出處,并自負(fù)版權(quán)等法律責(zé)任。

如涉及作品內(nèi)容、版權(quán)等問題,請?jiān)谧髌钒l(fā)表之日起一周內(nèi)與本網(wǎng)聯(lián)系,否則視為放棄相關(guān)權(quán)利。

廣告
OEM清單文件: OEM清單文件
*公司名:
*聯(lián)系人:
*手機(jī)號碼:
QQ:
有效期:

掃碼下載APP,
一鍵連接廣大的電子世界。

在線人工客服

買家服務(wù):
賣家服務(wù):
技術(shù)客服:

0571-85317607

網(wǎng)站技術(shù)支持

13606545031

客服在線時(shí)間周一至周五
9:00-17:30

關(guān)注官方微信號,
第一時(shí)間獲取資訊。

建議反饋

聯(lián)系人:

聯(lián)系方式:

按住滑塊,拖拽到最右邊
>>
感謝您向阿庫提出的寶貴意見,您的參與是維庫提升服務(wù)的動力!意見一經(jīng)采納,將有感恩紅包奉上哦!