forked from jens/Automation
Trying to fix notifications.
This commit is contained in:
parent
810b6f03aa
commit
221cfa4339
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user