{"id":101,"date":"2015-10-14T13:12:41","date_gmt":"2015-10-14T04:12:41","guid":{"rendered":"http:\/\/medicalfields.jp\/blog\/?p=101"},"modified":"2017-03-02T14:02:47","modified_gmt":"2017-03-02T05:02:47","slug":"bluetoothspplibrary%e3%81%a7%e3%82%88%e3%81%8flost%e3%81%97%e3%81%a6%e3%81%9f%e5%95%8f%e9%a1%8c","status":"publish","type":"post","link":"https:\/\/medicalfields.jp\/blog\/java\/bluetoothspplibrary%e3%81%a7%e3%82%88%e3%81%8flost%e3%81%97%e3%81%a6%e3%81%9f%e5%95%8f%e9%a1%8c\/","title":{"rendered":"BluetoothSPPLibrary\u3067\u3088\u304fLost\u3057\u3066\u305f\u554f\u984c"},"content":{"rendered":"<p>BluetoothSPPLibrary\u306f\u7d50\u69cb\u512a\u79c0\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3067\u4f7f\u7528\u3057\u3066\u3044\u305f\u306e\u3060\u3051\u3069\u3001\u56de\u8ee2\u6642\u3068\u304b\u3001Activity\u304b\u3089\u96e2\u308c\u305f\u6642\u306bLost\u3059\u308b\u3053\u3068\u304c\u591a\u304b\u3063\u305f\u3002\u3067\u3082onDestory\u3068\u304b\u3067bt.stop\u3068\u304b\u3057\u3066\u3044\u305f\u3089\u307e\u3041\u3001\u52d5\u304f\u4e8b\u304c\u591a\u304b\u3063\u305f\u304b\u3089\u305d\u306e\u307e\u307e\u653e\u7f6e\u3057\u3066\u3044\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u524d\u306b\u3082\u66f8\u3044\u305f\u304b\u3082\u3057\u308c\u306a\u3044\u3051\u3069\u306a\u305e\u306eActivity\u306e\u6b7b\u4ea1\u304c\u6642\u3005\u898b\u3089\u308c\u305f\u3002<\/p>\n<p>\u696d\u52d9\u30bd\u30d5\u30c8\u3067\u305f\u307e\u306b\u6b7b\u3093\u3067\u306f\u8a71\u306b\u306a\u3089\u306a\u3044\u306e\u3067\u6839\u672c\u7684\u306b\u898b\u76f4\u3059\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<p>\u7d50\u8ad6\u3002<\/p>\n<p>globals\u3067\u5b9a\u7fa9\u3057\u3066\u5bfe\u5fdc\u3002<\/p>\n<p>\u305f\u3063\u305f\u3053\u308c\u3060\u3051\u304b\u3082\u3057\u308c\u306a\u3044\u3051\u3069\u3068\u308a\u3042\u3048\u305a\u4eca\u306e\u3068\u3053\u308dAcvitiy\u6b7b\u306a\u306a\u3044\u3057\u3001\u3057\u304b\u3082Lost\u3082\u306a\u304f\u306a\u3063\u305f\u3002<\/p>\n<p>Globals\uff1a<\/p>\n<pre>public class Globals extends Application {\r\n    BluetoothSPP bt;<\/pre>\n<p>&nbsp;<\/p>\n<p>MainActivity\uff1a<\/p>\n<pre>@Override\r\nprotected void onStart() {\r\n    super.onStart();\r\n    \r\n    if(globals.bt==null)globals.bt = new BluetoothSPP(this.getApplicationContext());\r\n    if(!globals.bt.isBluetoothEnabled()) {\r\n        globals.bt.enable();\r\n        Toast.makeText(this, \"Bluetooth\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059\", Toast.LENGTH_SHORT).show();\r\n    } else {\r\n        if(!globals.bt.isServiceAvailable()) {\r\n            globals.bt.setupService();\r\n            globals.bt.startService(BluetoothState.DEVICE_OTHER);\r\n            setup();\r\n        }\r\n    }\r\n\r\n    if(!globals.bt.isBluetoothAvailable()) {\r\n\r\n        Toast.makeText(this, \"Bluetooth\u304c\u5b58\u5728\u3057\u307e\u305b\u3093\u3002\", Toast.LENGTH_SHORT).show();\r\n        \/\/ any command for bluetooth is not available\r\n    }<\/pre>\n<p>\u305f\u3063\u305f\u3053\u308c\u3060\u3051\u3067\u3068\u308a\u3042\u3048\u305a\u30bf\u30b9\u30af\u5207\u308a\u66ff\u3048\u3066\u3082\u5207\u65ad\u3055\u308c\u305a\u52d5\u3044\u305f\u3002<\/p>\n<p>\u3042\u3068\u306factivity\u304c\u8b0e\u306e\u6b7b\u3092\u9042\u3052\u306a\u3044\u304b\u3092\u7948\u308b\u3060\u3051\u3067\u3042\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>BluetoothSPPLibrary\u306f\u7d50\u69cb\u512a\u79c0\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3067\u4f7f\u7528\u3057\u3066\u3044\u305f\u306e\u3060\u3051\u3069\u3001\u56de\u8ee2\u6642\u3068\u304b\u3001Activity\u304b\u3089\u96e2\u308c\u305f\u6642\u306bLost\u3059\u308b\u3053\u3068\u304c\u591a\u304b\u3063\u305f\u3002\u3067\u3082onDestory\u3068\u304b\u3067bt.stop\u3068\u304b\u3057\u3066\u3044\u305f\u3089\u307e\u3041\u3001\u52d5 &hellip; <a href=\"https:\/\/medicalfields.jp\/blog\/java\/bluetoothspplibrary%e3%81%a7%e3%82%88%e3%81%8flost%e3%81%97%e3%81%a6%e3%81%9f%e5%95%8f%e9%a1%8c\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">BluetoothSPPLibrary\u3067\u3088\u304fLost\u3057\u3066\u305f\u554f\u984c<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[4],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6kJO0-1D","_links":{"self":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts\/101"}],"collection":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/comments?post=101"}],"version-history":[{"count":2,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts\/101\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts\/101\/revisions\/103"}],"wp:attachment":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/media?parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/categories?post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/tags?post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}