I have an application where sometimes Bluetooth channels are crashing from OS layer and then Bluetooth channel not start working again until phone rebooted. As its a OS layer crash I can't detect/handle it from my application. Here is the crash:
02-20 05:32:45.751: I/BluetoothServiceJni(20779): SOCK FLAG = 3 ***********************
02-20 05:32:45.751: E/BluetoothServiceJni(20779): Socket listen failed: 2
02-20 05:32:45.751: E/BluetoothAdapterService(1918354448)(20779): Failed to create socket channel
02-20 05:32:45.751: E/BluetoothSocketThread(762): Failed to listen for Bluetooth server socket connect.
02-20 05:32:45.751: E/BluetoothSocketThread(762): java.io.IOException: Error: -1
02-20 05:32:45.751: E/BluetoothSocketThread(762): at android.bluetooth.BluetoothAdapter.createNewRfcommSocketAndRecord(BluetoothAdapter.java:1245)
02-20 05:32:45.751: E/BluetoothSocketThread(762): at android.bluetooth.BluetoothAdapter.listenUsingRfcommWithServiceRecord(BluetoothAdapter.java:1161)
02-20 05:32:45.751: E/BluetoothSocketThread(762): at com.google.glass.bluetooth.BluetoothAdapter.listenUsingRfcommWithServiceRecord(BluetoothAdapter.java:148)
02-20 05:32:45.751: E/BluetoothSocketThread(762): at com.google.glass.bluetooth.companion.BluetoothSocketThread.runInternally(BluetoothSocketThread.java:67)
02-20 05:32:45.751: E/BluetoothSocketThread(762): at com.google.glass.bluetooth.companion.CompanionServerThread.run(CompanionServerThread.java:61)
02-20 05:32:45.761: W/BluetoothAdapter(762): getBluetoothService() called with no BluetoothManagerCallback
My question, is there any way to detect Bluetooth channel OS related crash from my applicaiton.
Is it possible to detect the crash using fabric crashlytics native support or anything else?
Related
I have an Xperia Z3C, Android 5.1.1 and I'm trying to connect it to a Nexus 4 Android 6.0.1 via Bluetooth. Pairing them is OK, but when I try to connect them, it says 'Connected' for less than a second and automatically disconnects.
Is this a known issue? I haven't found anything about this.
Here's what logcat says:
03-14 17:25:55.308: E/bt-btif(14245): bte_scan_filt_param_cfg_evt, 1
03-14 17:25:55.308: E/bt-btif(14245): bte_scan_filt_param_cfg_evt, 1
03-14 17:25:55.990: E/bt-btm(14245): new address: xx:xx:xx:xx:xx:xx
03-14 17:25:55.990: E/bt-btm(14245): new address: xx:xx:xx:xx:xx:xx
03-14 17:25:56.712: E/bt-btm(14245): new address: xx:xx:xx:xx:xx:xx
03-14 17:25:57.464: E/bt-btif(14245): bte_scan_filt_param_cfg_evt, 1
03-14 17:25:57.814: E/bt-btm(14245): Ignoring RNR as the state is not BTM_SEC_STATE_GETTING_NAME
03-14 17:25:57.933: E/NetlinkEvent(318): Unknown ifindex 41 in RTM_DELADDR
03-14 17:25:57.963: E/dhcpcd(15974): bt-pan: interface not found or invalid
03-14 17:25:57.986: E/BluetoothPanServiceJni(14245): ## ERROR : disconnectPanNative(L224): Failed disconnect pan channel, status: 1##
03-14 17:25:58.139: E/BluetoothTetheringNetworkFactory(14245): DHCP request error:DHCP result was failed
03-14 17:26:01.382: E/bt-btm(14245): btm_sec_disconnected - Clearing Pending flag
I had the same problem while trying to scan for Bluetooth devices from my Android application. The interesting thing is that it does not throw any exception (caught or uncaught) and fails silently! The problem occurs for devices with API Level >= 23 (Android 6.0). Here is an extract of my Logcat logs :
03-30 14:07:52.099 192-211/? I/BufferQueueProducer: [org.manios.testbt/org.manios.testbt.printing.BluetoothPrinterDiscovery](this:0x7fa16de400,id:1467,api:1,p:26262,c:192) queueBuffer: fps=0.19 dur=5154.29 max=5154.29 min=5154.29
03-30 14:07:52.114 192-192/? I/SurfaceFlinger: [Built-in Screen (type:0)] fps:1.091767,dur:1831.89,max:999.66,min:832.23
03-30 14:07:52.137 774-1001/? D/InputReader: AP_PROF:AppLaunch_dispatchPtr:Up:89556864, ID:0, Index:2056797440
03-30 14:07:52.137 774-1001/? I/PerfService: PerfServiceNative_boostEnableTimeoutMsAsync:3, 100
03-30 14:07:52.138 26262-26262/org.manios.testbt D/SettingsInterface: from settings cache , name = sound_effects_enabled , value = 0
03-30 14:07:52.138 26262-26262/org.manios.testbt D/BluetoothAdapter: isEnabled
03-30 14:07:52.140 26262-26262/org.manios.testbt D/BluetoothAdapter: getName
03-30 14:07:52.141 774-1636/? D/BluetoothManagerService: checkIfCallerIsForegroundUser: valid=true callingUser=0 parentUser=-10000 foregroundUser=0
03-30 14:07:52.142 21807-21818/? D/BluetoothAdapterProperties: getName: mName = Lenovo TAB3 8
03-30 14:07:52.144 26262-666/org.manios.testbt D/BluetoothAdapter: isEnabled
03-30 14:07:52.146 26262-666/org.manios.testbt D/BluetoothAdapter: isDiscovering
03-30 14:07:52.148 26262-666/org.manios.testbt D/BluetoothAdapter: 109507751: getState(). Returning 12
03-30 14:07:52.152 21807-21817/? D/BluetoothAdapterProperties: isDiscovering: mDiscovering = false
03-30 14:07:52.156 26262-666/org.manios.testbt D/BluetoothAdapter: startDiscovery
03-30 14:07:52.158 26262-666/org.manios.testbt D/BluetoothAdapter: 109507751: getState(). Returning 12
03-30 14:07:52.160 21807-21830/? W/bt_btif: bta_dm_check_av:0
03-30 14:07:52.172 21807-21830/? E/bt_btif: bte_scan_filt_param_cfg_evt, 1
03-30 14:07:52.181 21807-21823/? I/BluetoothAdapterProperties: Callback:discoveryStateChangeCallback with state:1
03-30 14:07:52.182 774-2924/? V/ActivityManager: Broadcast: Intent { act=android.bluetooth.adapter.action.DISCOVERY_STARTED flg=0x10 } ordered=false userid=0 callerApp=ProcessRecord{c376192 21807:com.android.bluetooth/1002}
03-30 14:07:52.184 1057-1265/? V/BluetoothEventManager: Received android.bluetooth.adapter.action.DISCOVERY_STARTED
03-30 14:07:52.185 1057-1265/? D/BluetoothEventManager: scanning state change to true
03-30 14:07:52.186 21983-21983/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.bluetooth.adapter.action.DISCOVERY_STARTED flg=0x10 cmp=com.android.settings/.bluetooth.BluetoothDiscoveryReceiver }, receiver=com.android.settings.bluetooth.BluetoothDiscoveryReceiver#b02fe63
03-30 14:07:52.186 21983-21983/? V/BluetoothDiscoveryReceiver: Received: android.bluetooth.adapter.action.DISCOVERY_STARTED
03-30 14:07:52.187 21983-21983/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.bluetooth.adapter.action.DISCOVERY_STARTED flg=0x10 cmp=com.android.settings/.bluetooth.BluetoothDiscoveryReceiver } packageName=com.android.settings resultCode=-1 resultData=null resultExtras=null}
03-30 14:07:52.218 774-1001/? D/InputReader: AP_PROF:AppLaunch_dispatchPtr:Down:89556946, ID:0, Index:2056794048
03-30 14:07:52.219 774-1001/? I/PerfService: PerfServiceNative_boostEnableAsync:3
I found after some searching using this issue, that in API Level >= 23 (Android 6.0) we have to add the following permission to AndroidManifext.xml
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
so that scanning and other Bluetooth actions function properly.
In Android documentation it states in BluetoothAdapter.startDiscovery() that it requires BLUETOOTH_ADMIN permission with no further details. But if we take a look into BluetoothLeScanner.startScan(),it states clearly that:
Requires BLUETOOTH_ADMIN permission. An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get results.
Hope this helps!
So two things can be going on here. Either the second device that you are trying to maintain a connection with is having an issue maintaining a connection or there is an interference being caused between the two just long enough to break the connection but not long enough to terminate it completely.
I'm trying to run my app with Gmail Login on genymotion emulator. But I keep getting a Failed to find DRM plugin error. I have added the ARM translation zip to the emulator and gApps for the given device. The app runs perfectly on real devices(HTC desire 500 and a Nexus 5). The emulator is a Nexus 5 with Lollipop 5.1.
02-20 05:27:13.292 1693-2186/? E/Drm: Failed to find drm plugin
02-20 05:27:13.292 3684-3868/? W/DG.WV: Widevine DRM not supported on this device
02-20 05:27:13.292 3684-3868/? W/DG.WV: android.media.UnsupportedSchemeException: Failed to instantiate drm object.
02-20 05:27:13.292 3684-3868/? W/DG.WV: at android.media.MediaDrm.native_setup(Native Method)
02-20 05:27:13.292 3684-3868/? W/DG.WV: at android.media.MediaDrm.<init>(MediaDrm.java:180)
02-20 05:27:13.292 3684-3868/? W/DG.WV: at com.google.android.gms.droidguard.q.run(SourceFile:99)
02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.lang.Thread.run(Thread.java:818)
02-20 05:27:13.300 2686-3863/? V/BaseAuthAsyncOperation: access token request successful
02-20 05:27:13.301 3684-3735/? I/GoogleURLConnFactory: Using platform SSLCertificateSocketFactory
02-20 05:27:13.742 3471-3471/? I/adfjksf: Status{statusCode=INTERNAL_ERROR, resolution=null}
02-20 05:27:13.814 3471-3492/? W/EGL_emulation: eglSurfaceAttrib not implemented
02-20 05:27:13.814 3471-3492/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3ee7840, error=EGL_SUCCESS
02-20 05:27:14.837 2279-3867/? W/GLSUser: [AppCertManager] IOException while requesting key:
DRM is not supported in emulators as the hardware is not capable of that . You can check the availability of drm by installing Drm info application and run it in the emulator. Please find the link https://play.google.com/store/apps/details?id=com.androidfung.drminfo
I have followed this tutorial
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
My logcat shows error
10-05 21:25:05.154 443-498/com.example.shashi.pushnotification E/GMPM:
getGoogleAppId failed with status: 10
10-05 21:25:05.156 443-498/com.example.shashi.pushnotification E/GMPM:
Uploading is not possible. App measurement disabled
10-05 21:26:02.572 443-1181/com.example.shashi.pushnotification E/GCMRegistrar:
internal error: retry receiver class not set yet
10-05 21:26:44.331 443-1181/com.example.shashi.pushnotification E/shiashi GCM:
Failed to register on attempt 1:java.io.IOException: Post failed with error code 500
10-05 21:26:47.309 443-1181/com.example.shashi.pushnotification E/URL:
> http://shashi8600.esy.es/gcm/register.php
My andrdoid app has suddenly stopped detecting the Chromecast. All other apps are picking it up.
The logs show:
12-12 23:16:24.536: D/CastMediaRouteProvider(957): in onDiscoveryRequestChanged: request=DiscoveryRequest{ selector=MediaRouteSelector{ controlCategories=[com.google.cast.CATEGORY_CAST, com.google.cast.CATEGORY_CAST_APP_NAME:b1f0fdaf-05be-4941-8918-d140393ab734_1] }, activeScan=true, isValid=true }
12-12 23:16:24.536: D/CastMediaRouteProvider(957): stopping the scan
And:
12-16 14:59:43.411: D/NetworkRequest(3276): performGet: http://10.0.0.18:8008/apps/b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.411: D/SimpleHttpRequestImpl(3276): executing http request: GET http://10.0.0.18:8008/apps/b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.418: D/NetworkTask(3276): onPostExecute result: -4
12-16 14:59:43.418: D/ApplicationSupportFilterListener(3276): Device does not support app b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.434: D/SimpleHttpRequestImpl(3276): final URI: http://10.0.0.18:8008/apps/b1f0fdaf-05be-xxxxx_1
12-16 14:59:43.434: D/SimpleHttpRequestImpl(3276): status line: HTTP/1.1 404 Not Found
They key line is "Device does not support app [my application id]".
I have Idea 12 with configured Oracle SDK 1.6, and with Android SDK,
$ ./adb devices
List of devices attached
S5830c10eb068 device
Also, Eclipse allows me to run project directly on physical device, but Idea is just able to see that device - S5830c10eb068(Samsung gt-s5830, android 2.3.6) in some windows:
but even when I choose 'USB device' in 'Run Configuration' - nothing happens:
What should I do?
Also, there is errors in logcat after device plugged in:
02-20 03:59:35.419: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/9
02-20 03:59:35.419: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/9
02-20 03:59:35.439: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/9
02-20 03:59:35.439: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/9
02-20 03:59:35.539: ERROR/MountService(158): ### notifyShareAvailabilityChange :: method = ums, avail = false
02-20 03:59:35.549: ERROR/MountService(158): notifyShareAvailabilityChange :: send ACTION_UMS_CONNECTED
02-20 03:59:38.609: ERROR/MountService(158): ### notifyShareAvailabilityChange :: method = ums, avail = true
02-20 03:59:38.619: ERROR/MountService(158): notifyShareAvailabilityChange :: send ACTION_UMS_CONNECTED
02-20 03:59:39.639: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/42
02-20 03:59:39.639: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/42
02-20 03:59:39.919: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/42
02-20 03:59:39.919: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/42
02-20 03:59:40.219: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/42
02-20 03:59:40.219: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/42
02-20 04:00:12.689: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/9
02-20 04:00:12.689: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/9
02-20 04:00:12.699: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/9
02-20 04:00:12.699: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/9
02-20 04:00:12.809: ERROR/MountService(158): ### notifyShareAvailabilityChange :: method = ums, avail = false
02-20 04:00:12.819: ERROR/MountService(158): notifyShareAvailabilityChange :: send ACTION_UMS_CONNECTED
02-20 04:00:22.859: ERROR/MountService(158): ### notifyShareAvailabilityChange :: method = ums, avail = true
02-20 04:00:22.889: ERROR/MountService(158): notifyShareAvailabilityChange :: send ACTION_UMS_CONNECTED
02-20 04:03:52.719: ERROR/MountService(158): ### notifyShareAvailabilityChange :: method = ums, avail = false
02-20 04:03:52.729: ERROR/MountService(158): notifyShareAvailabilityChange :: send ACTION_UMS_CONNECTED
02-20 04:04:25.659: ERROR/MountService(158): ### notifyShareAvailabilityChange :: method = ums, avail = true
02-20 04:04:25.669: ERROR/MountService(158): notifyShareAvailabilityChange :: send ACTION_UMS_CONNECTED
02-20 04:59:09.369: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/9
02-20 04:59:09.369: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/9
02-20 04:59:09.389: ERROR/RingtoneManager(158): getActualDefaultRingtoneUri : content://media/internal/audio/media/9
02-20 04:59:09.399: ERROR/RingtoneManager(158): Uri.parse(uriString) : content://media/internal/audio/media/9
Also, if I chose 'Show chooser dialog' and then select 'run' from 'Run' menu - there is the same window as on the second picture opens.
You are trying to edit Defaults, but you need to create a new run configuration instead.
Refer to this documentation section for details.
Once configuration is created, you will be able to select it in the drop-down on the toolbar and Run/Debug buttons will become available.
Run --> Edit Configurations... --> General --> Show Chooser Dialog --> OK
Then run it again.
Select "show choice dialog" and you show dialog with device ID
On idea 13,in run configuration -> General -> target device -> USB devices
Maybe related to seeing the device in the chooser: On my machine the device is only in the list after I killed the ADB process manually (Task Manager -> "adb.exe *32"). Before that, there were no device in list or OK button grayed out.
(IntelliJ IDEA 13.0.2 Community)