mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-17 21:06:48 +01:00
Made sure to check notification listener access even after first launch because not having it can cause issues
This commit is contained in:
parent
d2a6353e8d
commit
bb1b31bcb4
@ -40,6 +40,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
@ -195,11 +196,13 @@ public class ControlCenterv2 extends AppCompatActivity
|
||||
* Ask for permission to intercept notifications on first run.
|
||||
*/
|
||||
Prefs prefs = GBApplication.getPrefs();
|
||||
if (prefs.getBoolean("firstrun", true)) {
|
||||
prefs.getPreferences().edit().putBoolean("firstrun", false).apply();
|
||||
|
||||
Set<String> set = NotificationManagerCompat.getEnabledListenerPackages(this);
|
||||
if (!set.contains(this.getPackageName())) { // If notification listener access hasn't been granted
|
||||
Intent enableIntent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||
startActivity(enableIntent);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
checkAndRequestPermissions();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user