File tree Expand file tree Collapse file tree
android/sdl_android/src/main/java/com/smartdevicelink/transport Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1519,11 +1519,15 @@ private void exitForeground(){
15191519 synchronized (NOTIFICATION_LOCK ) {
15201520 if (isForeground && !isPrimaryTransportConnected ()) { //Ensure that the service is in the foreground and no longer connected to a transport
15211521 DebugTool .logInfo ("SdlRouterService to exit foreground" );
1522- this .stopForeground (false ); //false is used because some phones have issues when trying to clear the notification at the same time
1522+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N ) {
1523+ this .stopForeground (Service .STOP_FOREGROUND_DETACH );
1524+ }else {
1525+ stopForeground (false );
1526+ }
15231527 NotificationManager notificationManager = (NotificationManager )getSystemService (Context .NOTIFICATION_SERVICE );
15241528 if (notificationManager != null ){
15251529 try {
1526- notificationManager .cancel ( FOREGROUND_SERVICE_ID );
1530+ notificationManager .cancelAll ( );
15271531 if ( Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
15281532 notificationManager .deleteNotificationChannel (SDL_NOTIFICATION_CHANNEL_ID );
15291533 }
You can’t perform that action at this time.
0 commit comments