Android Question Open a APP_NOTIFICATION_SETTINGS via intent - Android 9 and 10

Neojoy

Member
Licensed User
Longtime User
Hi, I need to open notifications settings via intent, on Android 7 I used the this code below and works fine, but in Android 9 or 10 it returns "activity not found".

B4X:
Dim in1 As Intent
in1.Initialize("android.settings.APP_NOTIFICATION_SETTINGS", "")
Dim jo As JavaObject
in1.PutExtra("app_uid", jo.InitializeContext.RunMethodJO("getApplicationInfo", Null).GetField("uid"))
in1.PutExtra("app_package", Application.PackageName)
StartActivity(in1)


I search over internet and I found this code in java and convert to B4A, I don't know if I did something wrong
Java:
Intent settingsIntent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        .putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName())
        .putExtra(Settings.EXTRA_CHANNEL_ID, MY_CHANNEL_ID);
startActivity(settingsIntent);

I tryed to use this code, but returns "activity not found" as well.

Any solution?
 

DonManfred

Expert
Licensed User
Longtime User
Sorry, my 1st answer was wrong. I deleted it afterwards.

Check this thread. It may contain the solution...

 
Upvote 0

Neojoy

Member
Licensed User
Longtime User
Sorry, my 1st answer was wrong. I deleted it afterwards.

Check this thread. It may contain the solution...


Great, worked fine!

Thank you!
 
Upvote 0
Top