Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
epicstudios856 committed Jan 26, 2024
2 parents a6d138d + 0fc5654 commit 38cfb38
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Expand Up @@ -13,6 +13,9 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-feature android:glEsVersion="0x00020000" />

Expand Down Expand Up @@ -155,4 +158,4 @@
android:value="ca-app-pub-3568137780412047~1296857222" />
</application>

</manifest>
</manifest>
28 changes: 28 additions & 0 deletions app/src/main/java/com/vectras/vm/MainActivity.java
Expand Up @@ -220,6 +220,34 @@ public static PackageInfo getAppInfo(Context context) {
}
}

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
Expand Down

0 comments on commit 38cfb38

Please sign in to comment.