Skip to content

Commit

Permalink
#53 Update to better support Android Oreo+
Browse files Browse the repository at this point in the history
  • Loading branch information
zello-eugene committed May 2, 2023
1 parent 128201b commit 728ffaa
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 4 deletions.
Binary file modified zello-sdk-sample-contacts/libs/zello-sdk.aar
Binary file not shown.
Binary file modified zello-sdk-sample-misc/libs/zello-sdk.aar
Binary file not shown.
Binary file modified zello-sdk-sample-ptt/libs/zello-sdk.aar
Binary file not shown.
Binary file modified zello-sdk-sample-signin/libs/zello-sdk.aar
Binary file not shown.
Binary file modified zello-sdk-sample/libs/zello-sdk.aar
Binary file not shown.
Binary file modified zello-sdk.aar
Binary file not shown.
1 change: 0 additions & 1 deletion zello-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ android.libraryVariants.all { variant ->

tasks.whenTaskAdded { task ->
if (task.name == "assembleRelease") {
task.finalizedBy "zelloSdkDocCreate"
task.finalizedBy "zelloSdkAarDeployReleaseToRoot"
task.finalizedBy "zelloSdkAarDeployReleaseToSamples"
}
Expand Down
13 changes: 10 additions & 3 deletions zello-sdk/src/main/java/com/zello/sdk/Sdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

/**
* The Sdk class acts as the implementation of the Zello SDK methods.
Expand Down Expand Up @@ -340,7 +341,10 @@ boolean signIn(@Nullable String network, @Nullable String username, @Nullable St
intent.putExtra(Constants.EXTRA_PASSWORD, md5(password));
intent.putExtra(Constants.EXTRA_PERISHABLE, perishable);
context.sendBroadcast(intent);
context.startService(_serviceIntent);
// Service intent in guaranteed to be non-null at this point
if (_serviceIntent != null) {
ContextCompat.startForegroundService(context, _serviceIntent);
}
return true;
}
if (_serviceBound) {
Expand Down Expand Up @@ -669,7 +673,10 @@ public void onServiceConnected(@Nullable ComponentName name, @Nullable IBinder s
return;
}
_serviceConnecting = false;
context.startService(_serviceIntent);
// Service intent in guaranteed to be non-null at this point
if (_serviceIntent != null) {
ContextCompat.startForegroundService(context, _serviceIntent);
}
if (_delayedShowBtAccessoriesNotifications != null) {
setShowBluetoothAccessoriesNotifications(_delayedShowBtAccessoriesNotifications);
}
Expand Down Expand Up @@ -973,7 +980,7 @@ private void connect() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
try {
PendingIntent.getService(context, 0, _serviceIntent,
PendingIntent.FLAG_UPDATE_CURRENT | ((Build.VERSION.SDK_INT > Build.VERSION_CODES.R) ? PendingIntent.FLAG_IMMUTABLE : 0)).send();
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE).send();
} catch (Throwable t) {
Log.INSTANCE.e("Failed to start service using a pending intent", t);
}
Expand Down

0 comments on commit 728ffaa

Please sign in to comment.