Fix start streaming

This commit is contained in:
tom79 2019-11-02 15:55:32 +01:00
parent 39628473fe
commit f997e8b687
1 changed files with 12 additions and 7 deletions

View File

@ -4967,20 +4967,25 @@ public class Helper {
public static void startStreaming(Context context) { public static void startStreaming(Context context) {
int liveNotifications = Helper.liveNotifType(context); int liveNotifications = Helper.liveNotifType(context);
Intent streamingIntent = null;
switch (liveNotifications){ switch (liveNotifications){
case Helper.NOTIF_LIVE: case Helper.NOTIF_LIVE:
Intent streamingIntent = new Intent(context, LiveNotificationService.class); streamingIntent = new Intent(context, LiveNotificationService.class);
try {
context.startService(streamingIntent);
}catch (Exception ignored){}
break; break;
case Helper.NOTIF_DELAYED: case Helper.NOTIF_DELAYED:
streamingIntent = new Intent(context, LiveNotificationDelayedService.class); streamingIntent = new Intent(context, LiveNotificationDelayedService.class);
try {
context.startService(streamingIntent);
}catch (Exception ignored){}
break; break;
} }
if( streamingIntent != null) {
try {
if (Build.VERSION.SDK_INT >= 26) {
context.startForegroundService(streamingIntent);
} else {
context.startService(streamingIntent);
}
context.startService(streamingIntent);
} catch (Exception ignored) {}
}
} }