summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2020-03-19 11:25:51 -0400
committerJoey Grover <joeygrover@gmail.com>2020-03-19 11:25:51 -0400
commitcd2cd7e5aeb7882cd4a6530c178885158e27c35e (patch)
tree37cdf43ba64ef70e3581f7f26a08cf1c85131724
parentad68f9b334709d067df087dfa3b121e6f48c6c56 (diff)
downloadsdl_android-bugfix/router_service_notification.tar.gz
Update logic after more testingbugfix/router_service_notification
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
index efe9e2328..3313fd0f3 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
@@ -1519,11 +1519,15 @@ public class SdlRouterService extends Service{
synchronized (NOTIFICATION_LOCK) {
if (isForeground && !isPrimaryTransportConnected()) { //Ensure that the service is in the foreground and no longer connected to a transport
DebugTool.logInfo("SdlRouterService to exit foreground");
- this.stopForeground(false); //false is used because some phones have issues when trying to clear the notification at the same time
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ this.stopForeground(Service.STOP_FOREGROUND_DETACH);
+ }else{
+ stopForeground(false);
+ }
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager!= null){
try {
- notificationManager.cancel(FOREGROUND_SERVICE_ID);
+ notificationManager.cancelAll();
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationManager.deleteNotificationChannel(SDL_NOTIFICATION_CHANNEL_ID);
}