Hint for notification access on Android 13

This commit is contained in:
Jens 2023-02-18 23:59:29 +01:00
parent 132f64114e
commit f49455712a
8 changed files with 37 additions and 4 deletions

View File

@ -47,6 +47,7 @@ public class ActivityPermissions extends Activity
private static final int requestCodeForPermissionsNotifications = 12046;
private static final int requestCodeForPermissionsDeviceAdmin = 12047;
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
private static final int requestCodeForPermissionNotificationAccessAndroid13 = 12049;
protected String[] specificPermissionsToRequest = null;
public static String intentExtraName = "permissionsToBeRequested";
@ -1046,14 +1047,33 @@ public class ActivityPermissions extends Activity
cachedPermissionsToRequest = requiredPermissions;
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
return;
}
else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE))
{
requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions;
Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
startActivityForResult(intent, requestCodeForPermissionsNotifications);
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);
cachedPermissionsToRequest = requiredPermissions;
requestNotificationAccess();
}
});
dialog.show();
}
else
{
requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions;
requestNotificationAccess();
}
return;
}
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()
{
AutomationService service = AutomationService.getInstance();

View File

@ -779,4 +779,5 @@
<string name="startAppByStartService">via startService()</string>
<string name="showToastsForEvents">Toasts anzeigen</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>

View File

@ -778,4 +778,5 @@
<string name="startAppByStartService">via startService()</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="notificationAccessAndroid13">Después de hacer clcliquear en OK, seleccione Automation, luego seleccione \"Permitir acceso a notificaciones\", luego \"Permitir\".</string>
</resources>

View File

@ -778,4 +778,5 @@
<string name="startAppByStartService">via startService()</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="notificationAccessAndroid13">Après avoir cliqué sur OK, sélectionnez Automatisation, puis sélectionnez « Autoriser l\'accès aux notifications », puis « Autoriser ».</string>
</resources>

View File

@ -779,4 +779,5 @@
<string name="startAppByStartService">tramite startService()</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="notificationAccessAndroid13">Dopo aver fatto clic su OK, selezionare Automazione, quindi selezionare \"Consenti accesso alle notifiche\", quindi \"Consenti\".</string>
</resources>

View File

@ -777,5 +777,6 @@
<string name="startAppByStartService">via startService()</string>
<string name="showToastsForEvents">Toon toasts</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>

View File

@ -836,4 +836,5 @@
<string name="startAppByStartService">дорога startService()</string>
<string name="showToastsForEvents">Показать тосты</string>
<string name="showToastsForEventsSummary">Отображение всплывающих уведомлений при таких событиях, как выполнение правил</string>
<string name="notificationAccessAndroid13">После нажатия кнопки «ОК» выберите «Автоматизация», затем выберите «Разрешить доступ к уведомлениям», затем «Разрешить».</string>
</resources>

View File

@ -876,4 +876,5 @@
<string name="startAppByStartService">by startService()</string>
<string name="showToastsForEvents">Show toasts</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>