Commit 52e84d00 by Sebastián Katzer

Sound wird unter Android immer abgespielt, falls GET_TASKS permission fehlt

parent ef127dd1
...@@ -87,10 +87,15 @@ public class LocalNotificationReceiver extends BroadcastReceiver { ...@@ -87,10 +87,15 @@ public class LocalNotificationReceiver extends BroadcastReceiver {
.setTicker(options.getTitle()) .setTicker(options.getTitle())
.setSmallIcon(options.getIcon()); .setSmallIcon(options.getIcon());
try {
if (!context.getPackageName().equalsIgnoreCase(((ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0).topActivity.getPackageName())) { if (!context.getPackageName().equalsIgnoreCase(((ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0).topActivity.getPackageName())) {
// app is in background // app is in background
notification.setDefaults(Notification.DEFAULT_SOUND); notification.setDefaults(Notification.DEFAULT_SOUND);
} }
} catch (Exception e) {
// missing GET_TASKS permission
notification.setDefaults(Notification.DEFAULT_SOUND);
}
/* /*
* If you want all reminders to stay in the notification bar, you should * If you want all reminders to stay in the notification bar, you should
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment