From cf4ec286ae6f932992aa3daf74d9b25a7339e375 Mon Sep 17 00:00:00 2001 From: jens Date: Mon, 10 Jan 2022 19:32:44 +0100 Subject: [PATCH] Notification action --- app/build.gradle | 4 +- .../java/com/jens/automation2/Actions.java | 4 +- .../jens/automation2/ActivityPermissions.java | 8 +- .../jens/automation2/AutomationService.java | 44 +++--- .../com/jens/automation2/Miscellaneous.java | 146 ++++++++++++------ app/src/main/res/drawable/info.xml | 10 ++ ...vity_manage_action_create_notification.xml | 34 ---- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-es/strings.xml | 2 +- app/src/main/res/values-it/strings.xml | 2 +- app/src/main/res/values-nl/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- .../android/de-DE/full_description.txt | 2 + .../android/en-US/full_description.txt | 2 + .../android/es-ES/full_description.txt | 2 + .../android/it-IT/full_description.txt | 2 + .../android/nl-NL/full_description.txt | 2 + 17 files changed, 153 insertions(+), 117 deletions(-) create mode 100644 app/src/main/res/drawable/info.xml diff --git a/app/build.gradle b/app/build.gradle index 8bcaf08..d3a6879 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { compileSdkVersion 29 buildToolsVersion '29.0.2' useLibrary 'org.apache.http.legacy' - versionCode 116 - versionName "1.7.2" + versionCode 117 + versionName "1.7.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/jens/automation2/Actions.java b/app/src/main/java/com/jens/automation2/Actions.java index eb7c78c..0858fb4 100644 --- a/app/src/main/java/com/jens/automation2/Actions.java +++ b/app/src/main/java/com/jens/automation2/Actions.java @@ -8,7 +8,6 @@ import android.app.PendingIntent; import android.app.admin.DevicePolicyManager; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothManager; import android.bluetooth.BluetoothProfile; import android.content.ActivityNotFoundException; import android.content.Context; @@ -28,7 +27,6 @@ import android.telephony.SmsManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; -import android.view.WindowManager; import android.widget.Toast; import androidx.annotation.RequiresApi; @@ -92,7 +90,7 @@ public class Actions { String title = Miscellaneous.replaceVariablesInText(elements[0], Miscellaneous.getAnyContext()); String text = Miscellaneous.replaceVariablesInText(elements[1], Miscellaneous.getAnyContext()); - Miscellaneous.createDismissableNotification(title, text, notificationId, null); + Miscellaneous.createDismissibleNotification(title, text, notificationId, false, AutomationService.NOTIFICATION_CHANNEL_ID_RULES, null); } catch (Exception e) { diff --git a/app/src/main/java/com/jens/automation2/ActivityPermissions.java b/app/src/main/java/com/jens/automation2/ActivityPermissions.java index 57d2979..d2db3b9 100644 --- a/app/src/main/java/com/jens/automation2/ActivityPermissions.java +++ b/app/src/main/java/com/jens/automation2/ActivityPermissions.java @@ -529,7 +529,7 @@ public class ActivityPermissions extends Activity break; case sendTextMessage: addToArrayListUnique(Manifest.permission.SEND_SMS, requiredPermissions); - checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions); + getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions); break; case setAirplaneMode: addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions); @@ -588,7 +588,7 @@ public class ActivityPermissions extends Activity // addToArrayListUnique("android.permission.TETHER_PRIVILEGED", requiredPermissions); break; case speakText: - checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions); + getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions); break; case startOtherActivity: if( @@ -608,7 +608,7 @@ public class ActivityPermissions extends Activity break; case triggerUrl: addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions); - checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions); + getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions); break; case turnBluetoothOff: addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions); @@ -1150,7 +1150,7 @@ public class ActivityPermissions extends Activity } } - static ArrayList checkPermissionsInVariableUse(String text, ArrayList permsList) + static ArrayList getPermissionsForVariablesInUse(String text, ArrayList permsList) { /* [uniqueid] diff --git a/app/src/main/java/com/jens/automation2/AutomationService.java b/app/src/main/java/com/jens/automation2/AutomationService.java index abf36e2..51d4aac 100644 --- a/app/src/main/java/com/jens/automation2/AutomationService.java +++ b/app/src/main/java/com/jens/automation2/AutomationService.java @@ -41,8 +41,16 @@ public class AutomationService extends Service implements OnInitListener protected final static int notificationIdRestrictions = 1005; protected final static int notificationIdLocationRestriction = 1006; - final static String NOTIFICATION_CHANNEL_ID = "com.jens.automation2"; - final static String channelName = "Service notification"; +// final static String NOTIFICATION_CHANNEL_ID = "com.jens.automation2"; + + final static String NOTIFICATION_CHANNEL_ID_SERVICE = "com.jens.automation2_service"; + final static String NOTIFICATION_CHANNEL_NAME_SERVICE = "Service notification"; + + final static String NOTIFICATION_CHANNEL_ID_FUNCTIONALITY = "com.jens.automation2_functionality"; + final static String NOTIFICATION_CHANNEL_NAME_FUNCTIONALITY = "Functionality information"; + + final static String NOTIFICATION_CHANNEL_ID_RULES = "com.jens.automation2_rules"; + final static String NOTIFICATION_CHANNEL_NAME_RULES = "Rule notifications"; protected static Notification myNotification; protected static NotificationCompat.Builder notificationBuilder = null; @@ -205,7 +213,7 @@ public class AutomationService extends Service implements OnInitListener Intent myIntent = new Intent(this, ActivityMainTabLayout.class); myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, 0); - notificationBuilder = createDefaultNotificationBuilder(); + notificationBuilder = createServiceNotificationBuilder(); updateNotification(); @@ -365,9 +373,9 @@ public class AutomationService extends Service implements OnInitListener Miscellaneous.logEvent("w", "Features disabled", "Features disabled because of rule " + rule, 5); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) - Miscellaneous.createDismissableNotificationWithDelay(1010, null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi); + Miscellaneous.createDismissibleNotificationWithDelay(1010, null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi); else - Miscellaneous.createDismissableNotification(null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi); + Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi); } } } @@ -389,9 +397,9 @@ public class AutomationService extends Service implements OnInitListener Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) - Miscellaneous.createDismissableNotificationWithDelay(3300, null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi); + Miscellaneous.createDismissibleNotificationWithDelay(3300, null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi); else - Miscellaneous.createDismissableNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi); + Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi); } } } @@ -411,9 +419,9 @@ public class AutomationService extends Service implements OnInitListener Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) - Miscellaneous.createDismissableNotificationWithDelay(2200, null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi); + Miscellaneous.createDismissibleNotificationWithDelay(2200, null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi); else - Miscellaneous.createDismissableNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi); + Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi); } } @@ -482,7 +490,7 @@ public class AutomationService extends Service implements OnInitListener return builder; } - protected static NotificationCompat.Builder createDefaultNotificationBuilder() + protected static NotificationCompat.Builder createServiceNotificationBuilder() { NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE); @@ -490,14 +498,14 @@ public class AutomationService extends Service implements OnInitListener if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW); -// chan.setLightColor(Color.BLUE); - chan.enableVibration(false); - chan.setSound(null, null); - chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); - mNotificationManager.createNotificationChannel(chan); + NotificationChannel channel = Miscellaneous.getNotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE); +// channel.setLightColor(Color.BLUE); + channel.enableVibration(false); + channel.setSound(null, null); + channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); + mNotificationManager.createNotificationChannel(channel); - builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID); + builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID_SERVICE); } else builder = new NotificationCompat.Builder(AutomationService.getInstance()); @@ -576,7 +584,7 @@ public class AutomationService extends Service implements OnInitListener String textToDisplay = bodyText + " " + lastRuleString; if(notificationBuilder == null) - notificationBuilder = createDefaultNotificationBuilder(); + notificationBuilder = createServiceNotificationBuilder(); notificationBuilder.setContentText(textToDisplay); notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay)); diff --git a/app/src/main/java/com/jens/automation2/Miscellaneous.java b/app/src/main/java/com/jens/automation2/Miscellaneous.java index 66b37eb..20737f2 100644 --- a/app/src/main/java/com/jens/automation2/Miscellaneous.java +++ b/app/src/main/java/com/jens/automation2/Miscellaneous.java @@ -8,7 +8,6 @@ import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; -import android.content.ContentProvider; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -16,6 +15,8 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.Cursor; +import android.media.AudioAttributes; +import android.media.RingtoneManager; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; @@ -26,7 +27,6 @@ import android.os.IBinder; import android.provider.MediaStore; import android.provider.Settings.Secure; import android.telephony.PhoneNumberUtils; -import android.telephony.TelephonyManager; import android.util.Base64; import android.util.Log; import android.widget.Toast; @@ -83,6 +83,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.List; import java.util.Scanner; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -98,13 +99,10 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import androidx.annotation.RequiresApi; import androidx.core.app.NotificationCompat; import androidx.documentfile.provider.DocumentFile; -import static android.provider.CalendarContract.CalendarCache.URI; -import static com.jens.automation2.AutomationService.NOTIFICATION_CHANNEL_ID; -import static com.jens.automation2.AutomationService.channelName; - public class Miscellaneous extends Service { protected static String writeableFolderStringCache = null; @@ -877,7 +875,7 @@ public class Miscellaneous extends Service @SuppressLint("NewApi") @SuppressWarnings("deprecation") - public static void createDismissableNotificationWithDelay(long delay, String title, String textToDisplay, int notificationId, PendingIntent pendingIntent) + public static void createDismissibleNotificationWithDelay(long delay, String title, String textToDisplay, int notificationId, String notificationChannelId, PendingIntent pendingIntent) { /* Now what's this about? @@ -903,7 +901,7 @@ public class Miscellaneous extends Service catch(Exception e) {} - createDismissableNotification(title, textToDisplay, notificationId, pendingIntent); + createDismissibleNotification(title, textToDisplay, notificationId, true, notificationChannelId, pendingIntent); return null; } @@ -924,46 +922,82 @@ public class Miscellaneous extends Service @SuppressLint("NewApi") @SuppressWarnings("deprecation") - public static void createDismissableNotification(String title, String textToDisplay, int notificationId, PendingIntent pendingIntent) + public static void createDismissibleNotification(String title, String textToDisplay, int notificationId, boolean vibrate, String notificationChannelId, PendingIntent pendingIntent) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - createDismissableNotificationSdk26(title, textToDisplay, notificationId, pendingIntent); + createDismissibleNotificationSdk26(title, textToDisplay, notificationId, vibrate, notificationChannelId, pendingIntent); return; } NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE); - NotificationCompat.Builder dismissableNotificationBuilder = createDismissableNotificationBuilder(pendingIntent); + NotificationCompat.Builder dismissibleNotificationBuilder = createDismissibleNotificationBuilder(vibrate, notificationChannelId, pendingIntent); if(title == null) - dismissableNotificationBuilder.setContentTitle(AutomationService.getInstance().getResources().getString(R.string.app_name)); + dismissibleNotificationBuilder.setContentTitle(AutomationService.getInstance().getResources().getString(R.string.app_name)); else - dismissableNotificationBuilder.setContentTitle(title); + dismissibleNotificationBuilder.setContentTitle(title); - dismissableNotificationBuilder.setContentText(textToDisplay); - dismissableNotificationBuilder.setContentIntent(pendingIntent); - dismissableNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay)); - dismissableNotificationBuilder.setAutoCancel(true); + dismissibleNotificationBuilder.setContentText(textToDisplay); + dismissibleNotificationBuilder.setContentIntent(pendingIntent); + dismissibleNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay)); + dismissibleNotificationBuilder.setAutoCancel(true); - Notification dismissableNotification = dismissableNotificationBuilder.build(); + if(notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_RULES)) + dismissibleNotificationBuilder.setSmallIcon(R.drawable.info); - mNotificationManager.notify(notificationId, dismissableNotification); + Notification dismissibleNotification = dismissibleNotificationBuilder.build(); - /*NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) - .setSmallIcon(R.drawable.ic_launcher) // notification icon - .setContentTitle("Notification!") // title for notification - .setContentText("Hello word") // message for notification - .setAutoCancel(true); // clear notification after click - Intent intent = new Intent(this, MainActivity.class); - PendingIntent pi = PendingIntent.getActivity(this,0,intent,Intent.FLAG_ACTIVITY_NEW_TASK); - mBuilder.setContentIntent(pi); - NotificationManager mNotificationManager = - (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - mNotificationManager.notify(0, dismissableNotification);*/ + mNotificationManager.notify(notificationId, dismissibleNotification); } - static void createDismissableNotificationSdk26(String title, String textToDisplay, int notificationId, PendingIntent pendingIntent) + @RequiresApi(api = Build.VERSION_CODES.O) + static NotificationChannel findExistingChannel(List channels, String channelId) + { + for(NotificationChannel c : channels) + { + if(c.getId().equals(channelId)) + return c; + } + + return null; + } + @RequiresApi(api = Build.VERSION_CODES.O) + static NotificationChannel getNotificationChannel(String channelId) + { + NotificationManager nm = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE); + List channels = nm.getNotificationChannels(); + if(channels.size() > 3) + { + for(NotificationChannel c : channels) + nm.deleteNotificationChannel(c.getId()); + } + + NotificationChannel channel = findExistingChannel(channels, channelId); + + if(channel == null) + { + switch (channelId) + { + case AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE: + channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, AutomationService.NOTIFICATION_CHANNEL_NAME_SERVICE, NotificationManager.IMPORTANCE_LOW); + break; + case AutomationService.NOTIFICATION_CHANNEL_ID_FUNCTIONALITY: + channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_FUNCTIONALITY, AutomationService.NOTIFICATION_CHANNEL_NAME_FUNCTIONALITY, NotificationManager.IMPORTANCE_HIGH); + break; + case AutomationService.NOTIFICATION_CHANNEL_ID_RULES: + channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_RULES, AutomationService.NOTIFICATION_CHANNEL_NAME_RULES, NotificationManager.IMPORTANCE_HIGH); + break; + default: + break; + } + } + + return channel; + } + + static void createDismissibleNotificationSdk26(String title, String textToDisplay, int notificationId, boolean vibrate, String notificationChannelId, PendingIntent pendingIntent) { NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE); @@ -971,21 +1005,30 @@ 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_HIGH); -// chan.setLightColor(Color.BLUE); - chan.enableVibration(false); -// chan.setSound(null, null); - chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); - mNotificationManager.createNotificationChannel(chan); + NotificationChannel notificationChannel = getNotificationChannel(notificationChannelId); +// notificationChannel.setLightColor(Color.BLUE); + notificationChannel.enableVibration(vibrate); + try + { + Uri notificationSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); +// Uri notificationSound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE+ "://" +mContext.getPackageName()+"/"+R.raw.apple_ring)); +// Ringtone r = RingtoneManager.getRingtone(Miscellaneous.getAnyContext(), notification); + AudioAttributes.Builder b = new AudioAttributes.Builder(); + b.setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN); + notificationChannel.setSound(notificationSound, b.build()); + } + catch (Exception e) + { + Miscellaneous.logEvent("i", "Notification", Log.getStackTraceString(e), 2); + } + notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); + mNotificationManager.createNotificationChannel(notificationChannel); - builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID); + builder = new NotificationCompat.Builder(AutomationService.getInstance(), notificationChannel.getId()); } else builder = new NotificationCompat.Builder(AutomationService.getInstance()); -// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) -// builder.setCategory(Notification.CATEGORY_SERVICE); - builder.setWhen(System.currentTimeMillis()); builder.setContentIntent(pendingIntent); @@ -996,8 +1039,10 @@ public class Miscellaneous extends Service builder.setOnlyAlertOnce(true); - if(Settings.showIconWhenServiceIsRunning) + if(Settings.showIconWhenServiceIsRunning && notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE)) builder.setSmallIcon(R.drawable.ic_launcher); + else if(!notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE)) + builder.setSmallIcon(R.drawable.info); builder.setContentText(textToDisplay); builder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay)); @@ -1005,7 +1050,6 @@ public class Miscellaneous extends Service NotificationManager notificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(1, builder.build()); - // Intent notifyIntent = new Intent(context, notification.class); // notifyIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // @@ -1027,7 +1071,7 @@ public class Miscellaneous extends Service // notificationManager.notify(1, notification); } - protected static NotificationCompat.Builder createDismissableNotificationBuilder(PendingIntent myPendingIntent) + protected static NotificationCompat.Builder createDismissibleNotificationBuilder(boolean vibrate, String notificationChannelId, PendingIntent myPendingIntent) { NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE); @@ -1035,14 +1079,14 @@ public class Miscellaneous extends Service if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_HIGH); -// chan.setLightColor(Color.BLUE); -// chan.enableVibration(false); -// chan.setSound(null, null); - chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); - mNotificationManager.createNotificationChannel(chan); + NotificationChannel notificationChannel = getNotificationChannel(notificationChannelId); +// notificationChannel.setLightColor(Color.BLUE); + notificationChannel.enableVibration(vibrate); +// notificationChannel.setSound(null, null); + notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); + mNotificationManager.createNotificationChannel(notificationChannel); - builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID); + builder = new NotificationCompat.Builder(AutomationService.getInstance(), notificationChannelId); } else builder = new NotificationCompat.Builder(AutomationService.getInstance()); diff --git a/app/src/main/res/drawable/info.xml b/app/src/main/res/drawable/info.xml new file mode 100644 index 0000000..17255b7 --- /dev/null +++ b/app/src/main/res/drawable/info.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/activity_manage_action_create_notification.xml b/app/src/main/res/layout/activity_manage_action_create_notification.xml index be71b41..2a34c95 100644 --- a/app/src/main/res/layout/activity_manage_action_create_notification.xml +++ b/app/src/main/res/layout/activity_manage_action_create_notification.xml @@ -57,40 +57,6 @@ - - - - - - - - - - - - - - - - Ende Speichern URL, die ausgelöst werden soll: - Variablen:\nSie können die folgenden Variablen verwenden. Vor dem Auslösen werden sie mit dem entsprechenden Wert Ihres Geräts ersetzt. Die Klammern müssen in den Text mit aufgenommen werden.\n\n[uniqueid] - Die Unique ID Ihres Geräts\n[serialnr] - Die Seriennummer Ihres Geräts\n[latitude] - Ihr gegenwärtiger Breitengrad\n[longitude] - Ihr gegenwärtiger Längengrad\n[phonenr] - Nummer des letzten ein- oder ausgehenden Anrufs\n[d] - Tag des Monats, 2-stellig mit führender Null\n[m] - Monat als Zahl, mit führenden Nullen\n[Y] - Vierstellige Jahreszahl\n[h] - Stunde im 12-Stunden-Format, mit führenden Nullen\n[H] - Stunde im 24-Stunden-Format, mit führenden Nullen\n[i] - Minuten, mit führenden Nullen\n[s] - Sekunden, mit führenden Nullen\n[ms] - milliseconds\n[notificationTitle] - Titel der letzten Benachrichtigung\n[notificationText] - Text der letzten Benachrichtigung + Variablen:\nSie können die folgenden Variablen verwenden. Vor dem Auslösen werden sie mit dem entsprechenden Wert Ihres Geräts ersetzt. Die Klammern müssen in den Text mit aufgenommen werden.\n\n[uniqueid] - Die Unique ID Ihres Geräts\n[serialnr] - Die Seriennummer Ihres Geräts (< Android 9)\n[latitude] - Ihr gegenwärtiger Breitengrad\n[longitude] - Ihr gegenwärtiger Längengrad\n[phonenr] - Nummer des letzten ein- oder ausgehenden Anrufs\n[d] - Tag des Monats, 2-stellig mit führender Null\n[m] - Monat als Zahl, mit führenden Nullen\n[Y] - Vierstellige Jahreszahl\n[h] - Stunde im 12-Stunden-Format, mit führenden Nullen\n[H] - Stunde im 24-Stunden-Format, mit führenden Nullen\n[i] - Minuten, mit führenden Nullen\n[s] - Sekunden, mit führenden Nullen\n[ms] - milliseconds\n[notificationTitle] - Titel der letzten Benachrichtigung\n[notificationText] - Text der letzten Benachrichtigung WLAN Aktiviere Deaktiviere diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index b3ff303..3121be2 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -358,7 +358,7 @@ Red exactitud [m] Tiempo mínimo para cambio en milisegundos para actualizar posición Tiempo para actualizar [milisegundos] - Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo. Incluya las paréntecis en su texto. [uniqueid] - el número único de su dispositivo [serialnr] - el número de serie de su dispositivo [latitude] - su latitud [longitude] - su longitud [phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante [d] - Dia del mes, 2 digitos con cero al comienzo [m] - número del mes, 2 digitos con cero al comienzo [Y] - Número del año, 4 digitos [h] - Hora, formato 12 horas con cero al comienzo [H] - Hora, formato 24 horas con cero al comienzo [i] - Minutos con cero al comienzo [s] - Segundos con cero al comienzo [ms] - milisegundos [notificationTitle] - Título de la última notificación [notificationText] - Texto de la última notificación + Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo. Incluya las paréntecis en su texto.\n\n[uniqueid] - el número único de su dispositivo\n[serialnr] - el número de serie de su dispositivo (< Android 9)\n[latitude] - su latitud\n[longitude] - su longitud\n[phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante\n[d] - Dia del mes, 2 digitos con cero al comienzo\n[m] - número del mes, 2 digitos con cero al comienzo\n[Y] - Número del año, 4 digitos\n[h] - Hora, formato 12 horas con cero al comienzo\n[H] - Hora, formato 24 horas con cero al comienzo\n[i] - Minutos con cero al comienzo\n[s] - Segundos con cero al comienzo\n[ms] - milisegundos\n[notificationTitle] - Título de la última notificación\n[notificationText] - Texto de la última notificación Rotación del monitor todavia esta activado. Rotación del monitor todavia esta desactivado. Se puede usar la lista de wifis conocidos para determinar los sitios en los cuales estuvo. Por eso el permiso de localización es necesario para cargar la lista de wifis. Si quiere elegir uno de la lista tiene que conceder el permiso. En caso contrario todavia puede introducir un nombre wifi manualmente. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5e6f5aa..d05e1fe 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -533,7 +533,7 @@ Martedì Errore indeterminato. finchè - Variabili:\n È possibile utilizzare le seguenti variabili. All\'attivazione saranno sostituite con il valore corrispondente sul dispositivo. Includi le parentesi nel tuo testo.\n\n[uniqueid] - Il numero di serie del tuo dispositivo\n[serialnr] - Il serial number del tuo dispositivio\n[latitude] - La latitudine del tuo dispositivo\n[longitude] - La longitudine del tuo dispositivo\n[phonenr] - Numero dell\'ultima chiamata (entrante o uscente)\n[d] - Il giorno del mese, sempre 2 cifre\n[m] - Mese in formato numerico, sempre 2 cifre\n[Y] - L\’anno, sempre 4 cifre\n[h] - Ore in formato 12 ore, sempre 2 cifre con due punti\n[H] - Ore in formato 24 ore, sempre 2 cifre con due punti\n[i] - Minuti, sempre 2 cifre\n[s] - Secondi, sempre 2 cifre\n[ms] - millisecondi, sempre 3 cifre [notificationTitle] - titolo dell\'ultima notifica [notificationText] - testo dell\'ultima notifica + Variabili:\n È possibile utilizzare le seguenti variabili. All\'attivazione saranno sostituite con il valore corrispondente sul dispositivo. Includi le parentesi nel tuo testo.\n\n[uniqueid] - Il numero di serie del tuo dispositivo\n[serialnr] - Il serial number del tuo dispositivio (< Android 9)\n[latitude] - La latitudine del tuo dispositivo\n[longitude] - La longitudine del tuo dispositivo\n[phonenr] - Numero dell\'ultima chiamata (entrante o uscente)\n[d] - Il giorno del mese, sempre 2 cifre\n[m] - Mese in formato numerico, sempre 2 cifre\n[Y] - L\’anno, sempre 4 cifre\n[h] - Ore in formato 12 ore, sempre 2 cifre con due punti\n[H] - Ore in formato 24 ore, sempre 2 cifre con due punti\n[i] - Minuti, sempre 2 cifre\n[s] - Secondi, sempre 2 cifre\n[ms] - millisecondi, sempre 3 cifre [notificationTitle] - titolo dell\'ultima notifica [notificationText] - testo dell\'ultima notifica URL da caricare: L\'url deve avere almeno 10 caratteri. Questo molto probabilmente non funzionerà dato che sei su una versione superiore ad Android 2.3. Tuttavia è possibile utilizzare la connessione wifi tethering per attivare la regola. diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 69915d0..f92ba0b 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -56,7 +56,7 @@ Einde Opslaan URL om te activeren: - Variabelen:U kunt de volgende variabelen gebruiken. Bij het triggeren zullen ze worden vervangen door de corresponderende waarde op je apparaat. Zet de haakjes in uw tekst. \n[uniqueid] - Het unieke id van uw apparaat[serienummer] - Het serienummer van uw apparaat[latitude] - De breedtegraad van uw apparaat[longitude] - De lengtegraad van uw apparaat[phonenr] - Nummer van het laatste inkomende of uitgaande gesprek[d] - Dag van de maand, 2 cijfers met voorloopnullen[m] - Numerieke weergave van een maand, met voorloopnullen[Y] - een volledige numerieke weergave van een jaar, 4 cijfers[h] - 12-uurs indeling van een uur, met voorloopnullen[H] - 24-uurs indeling van een uur, met voorloopnullen[i] - minuten, met voorloopnullen[s] - seconden, met voorloopnullen[ms] - milliseconden[notificationTitle] - titel van de laatste melding[notificationText] - tekst van de laatste melding + Variabelen:U kunt de volgende variabelen gebruiken. Bij het triggeren zullen ze worden vervangen door de corresponderende waarde op je apparaat. Zet de haakjes in uw tekst. \n[uniqueid] - Het unieke id van uw apparaat[serialnr] - Het serienummer van uw apparaat (< Android 9)[latitude] - De breedtegraad van uw apparaat[longitude] - De lengtegraad van uw apparaat[phonenr] - Nummer van het laatste inkomende of uitgaande gesprek[d] - Dag van de maand, 2 cijfers met voorloopnullen[m] - Numerieke weergave van een maand, met voorloopnullen[Y] - een volledige numerieke weergave van een jaar, 4 cijfers[h] - 12-uurs indeling van een uur, met voorloopnullen[H] - 24-uurs indeling van een uur, met voorloopnullen[i] - minuten, met voorloopnullen[s] - seconden, met voorloopnullen[ms] - milliseconden[notificationTitle] - titel van de laatste melding[notificationText] - tekst van de laatste melding wifi Activeren Deactiveren diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 874f3b0..ffe358e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -70,7 +70,7 @@ End Save URL to trigger: - Variables:\nYou can use the following variables. Upon triggering they will be replaced with the corresponding value on your device. Include the brackets in your text.\n\n[uniqueid] - Your device\'s unique id\n[serialnr] - Your device\'s serial number\n[latitude] - Your device\'s latitude\n[longitude] - Your device\'s longitude\n[phonenr] - Number of last incoming or outgoing call\n[d] - Day of the month, 2 digits with leading zeros\n[m] - Numeric representation of a month, with leading zeros\n[Y] - A full numeric representation of a year, 4 digits\n[h] - 12-hour format of an hour with leading zeros\n[H] - 24-hour format of an hour with leading zeros\n[i] - Minutes with leading zeros\n[s] - Seconds, with leading zeros\n[ms] - milliseconds\n[notificationTitle] - title of last notification\n[notificationText] - text of last notification + Variables:\nYou can use the following variables. Upon triggering they will be replaced with the corresponding value on your device. Include the brackets in your text.\n\n[uniqueid] - Your device\'s unique id\n[serialnr] - Your device\'s serial number (< Android 9)\n[latitude] - Your device\'s latitude\n[longitude] - Your device\'s longitude\n[phonenr] - Number of last incoming or outgoing call\n[d] - Day of the month, 2 digits with leading zeros\n[m] - Numeric representation of a month, with leading zeros\n[Y] - A full numeric representation of a year, 4 digits\n[h] - 12-hour format of an hour with leading zeros\n[H] - 24-hour format of an hour with leading zeros\n[i] - Minutes with leading zeros\n[s] - Seconds, with leading zeros\n[ms] - milliseconds\n[notificationTitle] - title of last notification\n[notificationText] - text of last notification wifi Activating Deactivating diff --git a/fastlane/metadata/android/de-DE/full_description.txt b/fastlane/metadata/android/de-DE/full_description.txt index 9aceaca..4593912 100644 --- a/fastlane/metadata/android/de-DE/full_description.txt +++ b/fastlane/metadata/android/de-DE/full_description.txt @@ -20,6 +20,7 @@ Mögliche Auslöser: * Telefongespräch im Gange * Benachrichtigungen anderer Anwendungen * Geräteausrichtung (Gyroskop) +* Profile aktiv oder nicht Mögliche Aktionen: * WLAN ein-/ausschalten @@ -40,6 +41,7 @@ Mögliche Aktionen: * Bildschirmhelligkeit ändern * SMS verschicken * Sounddatei abspielen. +* Benachrichtigungen erstellen Es ist ziemlich schwierig diese Anwendung über die vielen verschiedenen Geräte und Android Versionen am Laufen zu halten. Ich kann vieles im Emulator testen, aber eben nicht alles. Wenn also eine bestimmte Funktion nicht so tut wie sie sollte - lassen Sie es mich wissen. Über die Jahre habe ich noch alle Fehler behoben, die mir vernünftig gemeldet wurden. Aber dafür bin ich auf Ihre Mithilfe angewiesen. diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index 6d6845a..77cb6e6 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -20,6 +20,7 @@ Supported triggers: * Phone call running * Notifications of other apps * Device orientation (gyroscope) +* Profile active or not Supported actions: * Change wifi state @@ -40,6 +41,7 @@ Supported actions: * Change screen brightness * Send text message * Play sound file +* Create notifications It's quite hard to keep this app working across the many different hardwares as well as the many changes Android undergoes over the versions. I can test it in the emulator, but that cannot show all bugs. So if a certain feature is not working on your device - let me know. Over the years I have fixed almost all bugs that have been reasonably reported to me. But for that I'm dependend on your input. diff --git a/fastlane/metadata/android/es-ES/full_description.txt b/fastlane/metadata/android/es-ES/full_description.txt index 9e0c49d..f9a3acf 100644 --- a/fastlane/metadata/android/es-ES/full_description.txt +++ b/fastlane/metadata/android/es-ES/full_description.txt @@ -20,6 +20,7 @@ Disparadores: * Llamado de teléfono activo * Notificaciónes de otras apps * Orientación del dispositivo (giroscopio) +* Perfil activado o no Aciónes: * Pasar de wifi @@ -40,6 +41,7 @@ Aciónes: * Cambiar luminosidad del monitor * Enviar mensaje * Tocar archivo sonido +* Crear notificaciones Es muy dificil mantener esta applicación functionando en todos los hardwares y versiónes de Android. Puedo probrar mucho en el emulator, pero no puedo enviar todos los errores. Si una función no funcióna - digame. En muchos años resolvaba la mayoria de los errores que los halladores me informaron bien. Pero dependo en su ayuda. diff --git a/fastlane/metadata/android/it-IT/full_description.txt b/fastlane/metadata/android/it-IT/full_description.txt index 582a126..3c22ac5 100644 --- a/fastlane/metadata/android/it-IT/full_description.txt +++ b/fastlane/metadata/android/it-IT/full_description.txt @@ -20,6 +20,7 @@ Eventi supportati: * Chiamata in esecuzione * Notificazione di un altra applicazione * Orientamento del dispositivo (giroscopio) +* Profilo attivo o meno Azioni supportate: * Cambia lo stato del wifi @@ -40,6 +41,7 @@ Azioni supportate: * Cambia la luminosità dello schermo * Manda un messaggio di testo * Esegui un file musicale +* Creare notifiche È piuttosto difficile mantere questa applicazione funzionante su tutti gli hardware esistenti ed includendo tutti i cambi che Android riceve fra una versione e l'altra. Posso effettuare tests nell'emulatore, ma non sarà possibile trovare tutti gli errori. Pertanto, se una certa funzione non funziona sul tuo dispositivo - fammelo sapere. Nel corso degli anni ho potuto risolvere tutti gli errori che sono stati riportati in maniera ragionevole. Infatti, per questo, dipendo dalle informazioni condivise. diff --git a/fastlane/metadata/android/nl-NL/full_description.txt b/fastlane/metadata/android/nl-NL/full_description.txt index 5fd26cb..d27980c 100644 --- a/fastlane/metadata/android/nl-NL/full_description.txt +++ b/fastlane/metadata/android/nl-NL/full_description.txt @@ -22,6 +22,7 @@ Ondersteunde triggers: * Lopend telefoongesprek * Meldingen van andere apps * Apparaat oriëntatie (gyroscoop) +* Profiel actief of niet Ondersteunde acties: * Wijzig wifi status @@ -42,6 +43,7 @@ Ondersteunde acties: * Verander de helderheid van het scherm * Verstuur tekstbericht * Geluidsbestand afspelen +* Meldingen maken Het is lastig om deze App werkend te houden over de vele verschillende hardware en de vele veranderingen die Android ondergaat in de loop der versies. Ik test het in een emulator, maar dat kan niet alle bugs laten zien.