diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e511c510..b5fdf45d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -5,6 +5,7 @@
+
@@ -50,4 +51,4 @@
android:enabled="true" />
-
\ No newline at end of file
+
diff --git a/app/src/main/java/xtr/keymapper/activity/MainActivity.java b/app/src/main/java/xtr/keymapper/activity/MainActivity.java
index 4555aa76..6f04ded1 100644
--- a/app/src/main/java/xtr/keymapper/activity/MainActivity.java
+++ b/app/src/main/java/xtr/keymapper/activity/MainActivity.java
@@ -1,25 +1,28 @@
package xtr.keymapper.activity;
+import static android.Manifest.permission.POST_NOTIFICATIONS;
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.res.ColorStateList;
+import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.provider.Settings;
import android.widget.Button;
-import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
-import xtr.keymapper.editor.EditorService;
import xtr.keymapper.R;
import xtr.keymapper.Server;
import xtr.keymapper.TouchPointer;
import xtr.keymapper.databinding.ActivityMainBinding;
+import xtr.keymapper.editor.EditorService;
import xtr.keymapper.fragment.SettingsFragment;
import xtr.keymapper.server.InputService;
@@ -71,6 +74,7 @@ public void startPointer(){
setButtonActive(binding.controls.startPointer);
binding.controls.startPointer.setText(R.string.stop);
binding.controls.startPointer.setOnClickListener(v -> stopPointer());
+ requestNotificationPermission();
}
}
@@ -114,6 +118,13 @@ private void checkOverlayPermission(){
}
}
+ private void requestNotificationPermission(){
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ if (!(checkSelfPermission(POST_NOTIFICATIONS) ==
+ PERMISSION_GRANTED)) requestPermissions(new String[]{POST_NOTIFICATIONS}, 0);
+ }
+ }
+
@Override
protected void onDestroy() {
if (pointerOverlay != null)
@@ -191,4 +202,4 @@ public void onServiceConnected(ComponentName className,
public void onServiceDisconnected(ComponentName arg0) {
}
};
-}
\ No newline at end of file
+}