Android 获取无线蓝牙MAC信息代码
来源:互联网 发布:网络出版是什么意思 编辑:程序博客网 时间:2024/06/02 00:21
转自:http://blog.csdn.net/tody_guo/article/details/6646709
- package org.example.itester;
- import android.app.Activity;
- import android.bluetooth.BluetoothAdapter;
- import android.content.Context;
- import android.content.Intent;
- import android.net.wifi.WifiInfo;
- import android.net.wifi.WifiManager;
- import android.os.Bundle;
- import android.widget.TextView;
- public class wifibtcheck extends ITester{
- private static final int REQUEST_ENABLE_BT = 3;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.wifibtcheck);
- mWifi = (WifiManager)getSystemService(Context.WIFI_SERVICE);
- if (!mWifi.isWifiEnabled())
- {
- mWifi.setWifiEnabled(true);
- }
- WifiInfo wifiInfo = mWifi.getConnectionInfo();
- bAdapt= BluetoothAdapter.getDefaultAdapter();
- if (bAdapt != null)
- {
- if (!bAdapt.isEnabled())
- {
- Intent enBT = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
- startActivityForResult(enBT, REQUEST_ENABLE_BT);
- }
- btMac = bAdapt.getAddress();
- }else{
- btMac = "No Bluetooth Device!";
- }
- if((WifiMac = wifiInfo.getMacAddress())== null)
- {
- WifiMac = "No Wifi Device";
- }
- TextView mac = (TextView)findViewById(R.id.macView);
- mac.setTextSize(38);
- mac.setText(" 无线MAC: "+ WifiMac + "\n 蓝牙MAC: " + btMac);
- }
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- switch (requestCode) {
- case REQUEST_ENABLE_BT:
- // When the request to enable Bluetooth returns
- if (resultCode == Activity.RESULT_OK) {
- // Bluetooth is now enabled, so set up a chat session
- } else {
- finish();
- }
- }
- }
- }
0 0
- Android 获取无线蓝牙MAC信息代码
- Android 获取无线蓝牙MAC信息代码
- Android 获取无线蓝牙MAC信息代码
- Android 获取无线蓝牙MAC信息代码
- android TV 获取有线mac和无线mac
- 获取蓝牙MAC地址
- Android获取系统信息代码
- android 代码获取版本信息
- Android获取蓝牙地址(非mac地址)
- Android无线蓝牙开发总结
- Android无线蓝牙开发总结
- android设备无线、有线网络下获取MAC地址
- Android 蓝牙获取不到服务(特性信息)
- iOS-获取蓝牙Mac地址
- ios_获取蓝牙mac地址
- 蓝牙Ble获取位置信息
- 获取硬盘ID信息及网卡MAC地址的代码
- Android中MAC地址获取代码
- Leetcode Merge Two Sorted Lists 合并两个有序链表
- Code我的人生
- 用adb logcat抓取log
- poj 3662 二分+最短路,求第k大最小权值
- HDU ACM 4503 湫湫系列故事——植树节
- Android 获取无线蓝牙MAC信息代码
- http中的Content-Type
- poj 3669 bfs水题预处理
- c++实现简单的建堆、维护堆和堆排序
- 利用rqt_plot与matlab分析KUKA youbot 的joint_states信息
- java Map及Map.Entry详解
- killall命令的实际应用
- 内存管理
- linux多进程之间的文件锁