Hint for notification access on Android 13
This commit is contained in:
		| @@ -47,6 +47,7 @@ public class ActivityPermissions extends Activity | |||||||
|     private static final int requestCodeForPermissionsNotifications = 12046; |     private static final int requestCodeForPermissionsNotifications = 12046; | ||||||
|     private static final int requestCodeForPermissionsDeviceAdmin = 12047; |     private static final int requestCodeForPermissionsDeviceAdmin = 12047; | ||||||
|     private static final int requestCodeForPermissionsBatteryOptimization = 12048; |     private static final int requestCodeForPermissionsBatteryOptimization = 12048; | ||||||
|  |     private static final int requestCodeForPermissionNotificationAccessAndroid13 = 12049; | ||||||
|     protected String[] specificPermissionsToRequest = null; |     protected String[] specificPermissionsToRequest = null; | ||||||
|  |  | ||||||
|     public static String intentExtraName = "permissionsToBeRequested"; |     public static String intentExtraName = "permissionsToBeRequested"; | ||||||
| @@ -1046,14 +1047,33 @@ public class ActivityPermissions extends Activity | |||||||
|                         cachedPermissionsToRequest = requiredPermissions; |                         cachedPermissionsToRequest = requiredPermissions; | ||||||
|                         Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS); |                         Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS); | ||||||
|                         startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy); |                         startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy); | ||||||
|  |  | ||||||
|                         return; |                         return; | ||||||
|                     } |                     } | ||||||
|                     else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE)) |                     else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE)) | ||||||
|  |                     { | ||||||
|  |                         if(Build.VERSION.SDK_INT >= 33) | ||||||
|  |                         { | ||||||
|  |                             AlertDialog dialog = Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.notificationAccessAndroid13), ActivityPermissions.this); | ||||||
|  |                             dialog.setOnDismissListener(new DialogInterface.OnDismissListener() | ||||||
|  |                             { | ||||||
|  |                                 @Override | ||||||
|  |                                 public void onDismiss(DialogInterface dialogInterface) | ||||||
|                                 { |                                 { | ||||||
|                                     requiredPermissions.remove(s); |                                     requiredPermissions.remove(s); | ||||||
|                                     cachedPermissionsToRequest = requiredPermissions; |                                     cachedPermissionsToRequest = requiredPermissions; | ||||||
|                         Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS); |                                     requestNotificationAccess(); | ||||||
|                         startActivityForResult(intent, requestCodeForPermissionsNotifications); |                                 } | ||||||
|  |                             }); | ||||||
|  |                             dialog.show(); | ||||||
|  |                         } | ||||||
|  |                         else | ||||||
|  |                         { | ||||||
|  |                             requiredPermissions.remove(s); | ||||||
|  |                             cachedPermissionsToRequest = requiredPermissions; | ||||||
|  |                             requestNotificationAccess(); | ||||||
|  |                         } | ||||||
|  |  | ||||||
|                         return; |                         return; | ||||||
|                     } |                     } | ||||||
|                     else if(s.equals(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) |                     else if(s.equals(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) | ||||||
| @@ -1128,6 +1148,12 @@ public class ActivityPermissions extends Activity | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     void requestNotificationAccess() | ||||||
|  |     { | ||||||
|  |         Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS); | ||||||
|  |         startActivityForResult(intent, requestCodeForPermissionsNotifications); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     protected void applyChanges() |     protected void applyChanges() | ||||||
|     { |     { | ||||||
|         AutomationService service = AutomationService.getInstance(); |         AutomationService service = AutomationService.getInstance(); | ||||||
|   | |||||||
| @@ -779,4 +779,5 @@ | |||||||
|     <string name="startAppByStartService">via startService()</string> |     <string name="startAppByStartService">via startService()</string> | ||||||
|     <string name="showToastsForEvents">Toasts anzeigen</string> |     <string name="showToastsForEvents">Toasts anzeigen</string> | ||||||
|     <string name="showToastsForEventsSummary">Popups anzeigen, wenn Ereignisse wie Regelausführungen auftreten</string> |     <string name="showToastsForEventsSummary">Popups anzeigen, wenn Ereignisse wie Regelausführungen auftreten</string> | ||||||
|  |     <string name="notificationAccessAndroid13">Nachdem Sie auf OK geklickt haben, wählen Sie Automatisierung, dann \"Benachrichtigungszugriff zulassen\" und dann \"Zulassen\".</string> | ||||||
| </resources> | </resources> | ||||||
| @@ -778,4 +778,5 @@ | |||||||
|     <string name="startAppByStartService">via startService()</string> |     <string name="startAppByStartService">via startService()</string> | ||||||
|     <string name="showToastsForEvents">Mostrar toasts</string> |     <string name="showToastsForEvents">Mostrar toasts</string> | ||||||
|     <string name="showToastsForEventsSummary">Mostrar notificaciones del sistema cuando se producen eventos como ejecuciones de reglas</string> |     <string name="showToastsForEventsSummary">Mostrar notificaciones del sistema cuando se producen eventos como ejecuciones de reglas</string> | ||||||
|  |     <string name="notificationAccessAndroid13">Después de hacer clcliquear en OK, seleccione Automation, luego seleccione \"Permitir acceso a notificaciones\", luego \"Permitir\".</string> | ||||||
| </resources> | </resources> | ||||||
| @@ -778,4 +778,5 @@ | |||||||
|     <string name="startAppByStartService">via startService()</string> |     <string name="startAppByStartService">via startService()</string> | ||||||
|     <string name="showToastsForEvents">Afficher les toasts</string> |     <string name="showToastsForEvents">Afficher les toasts</string> | ||||||
|     <string name="showToastsForEventsSummary">Afficher les toasts lorsque des événements tels que des exécutions de règles se produisent</string> |     <string name="showToastsForEventsSummary">Afficher les toasts lorsque des événements tels que des exécutions de règles se produisent</string> | ||||||
|  |     <string name="notificationAccessAndroid13">Après avoir cliqué sur OK, sélectionnez Automatisation, puis sélectionnez « Autoriser l\'accès aux notifications », puis « Autoriser ».</string> | ||||||
| </resources> | </resources> | ||||||
|   | |||||||
| @@ -779,4 +779,5 @@ | |||||||
|     <string name="startAppByStartService">tramite startService()</string> |     <string name="startAppByStartService">tramite startService()</string> | ||||||
|     <string name="showToastsForEvents">Mostra toast</string> |     <string name="showToastsForEvents">Mostra toast</string> | ||||||
|     <string name="showToastsForEventsSummary">Mostrare gli avvisi popup quando si verificano eventi come le esecuzioni di regole</string> |     <string name="showToastsForEventsSummary">Mostrare gli avvisi popup quando si verificano eventi come le esecuzioni di regole</string> | ||||||
|  |     <string name="notificationAccessAndroid13">Dopo aver fatto clic su OK, selezionare Automazione, quindi selezionare \"Consenti accesso alle notifiche\", quindi \"Consenti\".</string> | ||||||
| </resources> | </resources> | ||||||
|   | |||||||
| @@ -777,5 +777,6 @@ | |||||||
|     <string name="startAppByStartService">via startService()</string> |     <string name="startAppByStartService">via startService()</string> | ||||||
|     <string name="showToastsForEvents">Toon toasts</string> |     <string name="showToastsForEvents">Toon toasts</string> | ||||||
|     <string name="showToastsForEventsSummary">Pop-ups weergeven wanneer gebeurtenissen zoals regeluitvoeringen plaatsvinden</string> |     <string name="showToastsForEventsSummary">Pop-ups weergeven wanneer gebeurtenissen zoals regeluitvoeringen plaatsvinden</string> | ||||||
|  |     <string name="notificationAccessAndroid13">Nadat u op OK hebt geklikt, selecteert u Automatisering, selecteert u vervolgens \"Toegang tot meldingen toestaan\" en vervolgens \"toestaan\".</string> | ||||||
|  |  | ||||||
| </resources> | </resources> | ||||||
|   | |||||||
| @@ -836,4 +836,5 @@ | |||||||
|   <string name="startAppByStartService">дорога startService()</string> |   <string name="startAppByStartService">дорога startService()</string> | ||||||
|     <string name="showToastsForEvents">Показать тосты</string> |     <string name="showToastsForEvents">Показать тосты</string> | ||||||
|     <string name="showToastsForEventsSummary">Отображение всплывающих уведомлений при таких событиях, как выполнение правил</string> |     <string name="showToastsForEventsSummary">Отображение всплывающих уведомлений при таких событиях, как выполнение правил</string> | ||||||
|  |     <string name="notificationAccessAndroid13">После нажатия кнопки «ОК» выберите «Автоматизация», затем выберите «Разрешить доступ к уведомлениям», затем «Разрешить».</string> | ||||||
| </resources> | </resources> | ||||||
|   | |||||||
| @@ -876,4 +876,5 @@ | |||||||
|     <string name="startAppByStartService">by startService()</string> |     <string name="startAppByStartService">by startService()</string> | ||||||
|     <string name="showToastsForEvents">Show toasts</string> |     <string name="showToastsForEvents">Show toasts</string> | ||||||
|     <string name="showToastsForEventsSummary">Show toasts when events like rule executions occur</string> |     <string name="showToastsForEventsSummary">Show toasts when events like rule executions occur</string> | ||||||
|  |     <string name="notificationAccessAndroid13">After clicking ok, select Automation, then select \"Allow notification access\", then \"allow\".</string> | ||||||
| </resources> | </resources> | ||||||
		Reference in New Issue
	
	Block a user