This article only provides a relatively simple example of Bluetooth development. If you like android, you can just give it a try and think about it, small cainiao recommended parents read understand this blog after the column, then have a look at the little cainiao reprint good blog, address http://blog.csdn.net/woshishuoshuoa/article/details/9709371 ~~~ We sincerely welcome your valuable suggestions ~~~
1. Source Code:
Package com.example.com _ diecolor_demo13; import Java. util. list; import android.net. wiFi. wificonfiguration; import android.net. wiFi. wifiinfo; import android.net. wiFi. wifimanager; import android.net. wiFi. wifimanager. wifilock; import android. OS. bundle; import android. widget. textview; import android. widget. toast; import android. app. activity; public class mainactivity extends activity {textview; wifiman Ager wifimanager; wificonfiguration; wifiinfo; wifilock; @ overrideprotected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. activity_main); textview = (textview) findviewbyid (R. id. TV _main); wifimanager = (wifimanager) getsystemservice (wifi_service); // obtain the wifimanager object toast. maketext (this, "WiFi status:" + wifimanager. getwifist Ate (), 3000). Show (); If (! Wifimanager. iswifienabled () {// wifimanager. iswifienabled () determines whether WiFi is enabled // enable wifiwifimanager. setwifienabled (true); toast. maketext (this, "Current WiFi status:" + wifimanager. getwifistate (), 3000 ). show () ;}list <wificonfiguration> List = wifimanager. getconfigurednetworks (); // The configured list wifiinfo = wifimanager. getconnectioninfo (); // obtain the network connection information wifilock = wifimanager. createwifilock (1, "laoc"); // lock stringbuffer buffer = new stringbuffer (); For (wificonfiguration: List) {string tempstring = ""; tempstring + = "SSID: "+ wificonfiguration. SSID + "\ n" + "network ID" + inttoip (wificonfiguration. networkid) + "presponkey" + wificonfiguration. presharedkey + "status" + wificonfiguration. status + "Speed:" + wifiinfo. getlinkspeed (); buffer. append (tempstring);} textview. settext (buffer);}/** convert an int-type IP address to a 4-segment IP address **/private string inttoip (int ip) {return (IP & 0xff) + ". "+ (ip> 8) & 0xff) + ". "+ (ip> 16) & 0xff) + (ip> 24) & 0xff );}}
In androidmanifest. xml
2. Running result:
3. Conclusion: This column is just a simple introduction to some simple things about Bluetooth development... Not complete, To be continued...