diff --git a/app/src/googlePlayFlavor/java/com/jens/automation2/receivers/ActivityDetectionReceiver.java b/app/src/googlePlayFlavor/java/com/jens/automation2/receivers/ActivityDetectionReceiver.java index 90ca7e6c..26f568e9 100644 --- a/app/src/googlePlayFlavor/java/com/jens/automation2/receivers/ActivityDetectionReceiver.java +++ b/app/src/googlePlayFlavor/java/com/jens/automation2/receivers/ActivityDetectionReceiver.java @@ -3,6 +3,7 @@ package com.jens.automation2.receivers; import android.app.IntentService; import android.app.PendingIntent; import android.content.Intent; +import android.os.Build; import android.os.Bundle; import android.util.Log; @@ -13,6 +14,7 @@ import com.google.android.gms.location.ActivityRecognition; import com.google.android.gms.location.ActivityRecognitionApi; import com.google.android.gms.location.ActivityRecognitionResult; import com.google.android.gms.location.DetectedActivity; +import com.jens.automation2.ActivityDisplayLongMessage; import com.jens.automation2.ActivityPermissions; import com.jens.automation2.AutomationService; import com.jens.automation2.Miscellaneous; @@ -110,6 +112,14 @@ public class ActivityDetectionReceiver extends IntentService implements Automati } public static void startActivityDetectionReceiver() { + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) + { + if(!ActivityPermissions.havePermission("android.permission.ACTIVITY_RECOGNITION", Miscellaneous.getAnyContext())) + { + Miscellaneous.logEvent("w", "Activity Detection", "Don't have android.permission.ACTIVITY_RECOGNITION. Aborting receiver start..", 2); + return; + } + } try { Miscellaneous.logEvent("i", "ActivityDetectionReceiver", "Starting ActivityDetectionReceiver", 3); diff --git a/app/src/main/java/com/jens/automation2/Miscellaneous.java b/app/src/main/java/com/jens/automation2/Miscellaneous.java index 5f392d48..ac6fe832 100644 --- a/app/src/main/java/com/jens/automation2/Miscellaneous.java +++ b/app/src/main/java/com/jens/automation2/Miscellaneous.java @@ -856,10 +856,10 @@ public class Miscellaneous extends Service if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Functionality warnings", NotificationManager.IMPORTANCE_DEFAULT); + NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Functionality warnings", NotificationManager.IMPORTANCE_HIGH); // chan.setLightColor(Color.BLUE); chan.enableVibration(false); - chan.setSound(null, null); +// chan.setSound(null, null); chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); mNotificationManager.createNotificationChannel(chan); @@ -916,7 +916,7 @@ public class Miscellaneous extends Service if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW); + NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_HIGH); // chan.setLightColor(Color.BLUE); // chan.enableVibration(false); // chan.setSound(null, null);