diff --git a/zello-sdk-sample-contacts/libs/zello-sdk.aar b/zello-sdk-sample-contacts/libs/zello-sdk.aar index fc5e16a..0e29406 100644 Binary files a/zello-sdk-sample-contacts/libs/zello-sdk.aar and b/zello-sdk-sample-contacts/libs/zello-sdk.aar differ diff --git a/zello-sdk-sample-misc/libs/zello-sdk.aar b/zello-sdk-sample-misc/libs/zello-sdk.aar index fc5e16a..0e29406 100644 Binary files a/zello-sdk-sample-misc/libs/zello-sdk.aar and b/zello-sdk-sample-misc/libs/zello-sdk.aar differ diff --git a/zello-sdk-sample-ptt/libs/zello-sdk.aar b/zello-sdk-sample-ptt/libs/zello-sdk.aar index fc5e16a..0e29406 100644 Binary files a/zello-sdk-sample-ptt/libs/zello-sdk.aar and b/zello-sdk-sample-ptt/libs/zello-sdk.aar differ diff --git a/zello-sdk-sample-signin/libs/zello-sdk.aar b/zello-sdk-sample-signin/libs/zello-sdk.aar index fc5e16a..0e29406 100644 Binary files a/zello-sdk-sample-signin/libs/zello-sdk.aar and b/zello-sdk-sample-signin/libs/zello-sdk.aar differ diff --git a/zello-sdk-sample/libs/zello-sdk.aar b/zello-sdk-sample/libs/zello-sdk.aar index fc5e16a..b0045a7 100644 Binary files a/zello-sdk-sample/libs/zello-sdk.aar and b/zello-sdk-sample/libs/zello-sdk.aar differ diff --git a/zello-sdk.aar b/zello-sdk.aar index fc5e16a..0e29406 100644 Binary files a/zello-sdk.aar and b/zello-sdk.aar differ diff --git a/zello-sdk/src/main/java/com/zello/sdk/Sdk.java b/zello-sdk/src/main/java/com/zello/sdk/Sdk.java index fdbe022..e762888 100644 --- a/zello-sdk/src/main/java/com/zello/sdk/Sdk.java +++ b/zello-sdk/src/main/java/com/zello/sdk/Sdk.java @@ -343,7 +343,12 @@ boolean signIn(@Nullable String network, @Nullable String username, @Nullable St context.sendBroadcast(intent); // Service intent in guaranteed to be non-null at this point if (_serviceIntent != null) { - ContextCompat.startForegroundService(context, _serviceIntent); + try { + ContextCompat.startForegroundService(context, _serviceIntent); + } catch (Throwable t) { + // Caller may not be in the right state to start a service + Log.INSTANCE.e("Failed to start " + connectedPackage + " service", t); + } } return true; } @@ -675,7 +680,13 @@ public void onServiceConnected(@Nullable ComponentName name, @Nullable IBinder s _serviceConnecting = false; // Service intent in guaranteed to be non-null at this point if (_serviceIntent != null) { - ContextCompat.startForegroundService(context, _serviceIntent); + try { + ContextCompat.startForegroundService(context, _serviceIntent); + } catch (Throwable t) { + // Caller may not be in the right state to start a service + String componentPackageName = name != null ? name.getPackageName() : null; + Log.INSTANCE.e("Failed to start " + componentPackageName + " service", t); + } } if (_delayedShowBtAccessoriesNotifications != null) { setShowBluetoothAccessoriesNotifications(_delayedShowBtAccessoriesNotifications);