Do not show service running notification on onCreate

Sometimes (Bluetooth/Android Auto), the service is created and then just bound to.
That means that onStartCommand is never called. This causes a persistent notification.
Just in case the notification is somehow still shown to users, modified the message to
tell them how to hide it.
This commit is contained in:
ByteHamster 2020-05-27 11:48:19 +02:00
parent 1fc7352702
commit 0b60a8acee
2 changed files with 1 additions and 2 deletions

View File

@ -269,7 +269,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
stateManager = new PlaybackServiceStateManager(this);
notificationBuilder = new PlaybackServiceNotificationBuilder(this);
stateManager.startForeground(R.id.notification_playing, notificationBuilder.build());
registerReceiver(autoStateUpdated, new IntentFilter("com.google.android.gms.car.media.STATUS"));
registerReceiver(headsetDisconnected, new IntentFilter(Intent.ACTION_HEADSET_PLUG));

View File

@ -131,7 +131,7 @@ public class PlaybackServiceNotificationBuilder {
}
} else {
notification.setContentTitle(context.getString(R.string.app_name));
notification.setContentText("Service is running");
notification.setContentText("Loading. If this does not go away, play any episode and contact us.");
}
notification.setContentIntent(getPlayerActivityPendingIntent());