kopia lustrzana https://github.com/xdsopl/robot36
ask for notification and not for write permissions on Android 13
rodzic
23f3c6de02
commit
58eb1be3e4
|
@ -238,8 +238,13 @@ public class MainActivity extends AppCompatActivity {
|
|||
List<String> permissions = new ArrayList<>();
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)
|
||||
permissions.add(Manifest.permission.RECORD_AUDIO);
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
|
||||
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
|
||||
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
} else {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED)
|
||||
permissions.add(Manifest.permission.POST_NOTIFICATIONS);
|
||||
}
|
||||
if (permissions.isEmpty())
|
||||
return true;
|
||||
ActivityCompat.requestPermissions(this, permissions.toArray(new String[0]), permissionsID);
|
||||
|
|
Ładowanie…
Reference in New Issue