mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-04-30 15:29:51 +00:00
Merge branch 'master' of https://github.com/epicstudios856/Vectras-VM-Android
This commit is contained in:
commit
38cfb38b3f
2 changed files with 32 additions and 1 deletions
|
|
@ -220,6 +220,34 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void requestPermissions() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this, R.style.MainDialogTheme);
|
||||
alertDialog.setTitle(R.string.permission_title);
|
||||
alertDialog.setMessage(R.string.permission_notification_text);
|
||||
alertDialog.setPositiveButton("OK!", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.POST_NOTIFICATIONS}, 11003);
|
||||
}
|
||||
});
|
||||
alertDialog.create().show();
|
||||
} else {
|
||||
ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.POST_NOTIFICATIONS);
|
||||
}
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 11003);
|
||||
} else {
|
||||
ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION);
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 11003);
|
||||
} else {
|
||||
ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||
}
|
||||
|
||||
public void updateApp(final boolean showDialog) {
|
||||
new AppUpdater(this, new AppUpdater.OnUpdateListener() {
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue