bcsphere / bluetooth

Please support! Kindly "Star" this standard Bluetooth Smart API / SDK :) The "bcsphere/bluetooth" is a phonegap/cordova plugin. It's a Bluetooth JavaScript API from JUMA, a Bluetooth expert team. It supports both Bluetooth 4.0 GATT/Bluetooth Low Energy (BLE) interface in iOS/Android and Bluetooth 2.1 Classic Rfcomm / L2cap socket interface as Bluetooth Serial Port/SPP, as well as iBeacon!
Apache License 2.0
299 stars 12 forks source link

BC Receiver should unregister on Destroy #29

Closed mrichie closed 9 years ago

mrichie commented 9 years ago

as BC Receiver unregister after APP Activity exit, it will cause error like this at Activity onCreate lifecycle

E/ActivityThread(2932): Activity xxx has leaked IntentReceiver org.bcsphere.bluetooth.BCBluetooth$2@41c05cf8 that was originally registered here. Are you missing a call to unregisterReceiver()?
E/ActivityThread(2932):      at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:805)
E/ActivityThread(2932):      at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:606)
E/ActivityThread(2932):      at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1430)
E/ActivityThread(2932):      at android.app.ContextImpl.registerReceiver(ContextImpl.java:1410)
E/ActivityThread(2932):      at android.app.ContextImpl.registerReceiver(ContextImpl.java:1404)
E/ActivityThread(2932):      at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:467)
E/ActivityThread(2932):      at org.bcsphere.bluetooth.BCBluetooth.initialize(BCBluetooth.java:72)
E/ActivityThread(2932):      at org.apache.cordova.PluginEntry.createPlugin(PluginEntry.java:96)
E/ActivityThread(2932):      at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:195)
E/ActivityThread(2932):      at org.apache.cordova.PluginManager.init(PluginManager.java:106)
E/ActivityThread(2932):      at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:478)
E/ActivityThread(2932):      at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:465)
E/ActivityThread(2932):      at org.apache.cordova.CordovaWebView.loadUrl(CordovaWebView.java:435)
E/ActivityThread(2932):      at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:395)
E/ActivityThread(2932):      at org.xxx.onCreate(Baby.java:38)
E/ActivityThread(2932):      at android.app.Activity.performCreate(Activity.java:5231)