Android Question I need open a APP_NOTIFICATION_SETTINGS via intent

scsjc

Well-Known Member
Licensed User
Longtime User
Hello, i need a open via Intent a APP_NOTIFICATION_SETTINGS from android settings, i found this code:

B4X:
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", getPackageName());
intent.putExtra("app_uid", getApplicationInfo().uid);
StartActivity(intent);

and y try something like that but dont work:

B4X:
           Dim in1 As Intent
        in1.Initialize("android.settings.APP_NOTIFICATION_SETTINGS", "")
        in1.PutExtra("app_package", Application.PackageName)
        StartActivity(in1)


can help me???
thanks !!!
 

scsjc

Well-Known Member
Licensed User
Longtime User
Here:
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)

Thanks !!!!!!!!!!!!!!!!!!!!!!!!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1.
B4X:
#AdditionalJar: com.android.support:support-v4

2.
B4X:
Sub AreNotificationsEnabled As Boolean
   Dim jo As JavaObject
   Dim ctxt As JavaObject
   ctxt.InitializeContext
   jo = jo.InitializeStatic("android.support.v4.app.NotificationManagerCompat").RunMethod("from", Array(ctxt))
   Return jo.RunMethod("areNotificationsEnabled", Null)
End Sub
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
1.
B4X:
#AdditionalJar: com.android.support:support-v4

2.
B4X:
Sub AreNotificationsEnabled As Boolean
   Dim jo As JavaObject
   Dim ctxt As JavaObject
   ctxt.InitializeContext
   jo = jo.InitializeStatic("android.support.v4.app.NotificationManagerCompat").RunMethod("from", Array(ctxt))
   Return jo.RunMethod("areNotificationsEnabled", Null)
End Sub

Thanks !!!!!!!!!!!!
 
Upvote 0

Sgardy

Member
Licensed User
Longtime User
How can I do something of similar with this: IGNORE_BATTERY_OPTIMIZATION_SETTINGS ? If I just replace to
APP_NOTIFICATION_SETTINGS it give me the general settings and not targeted to my app...
And then... is there any guide to improve knowledge about this?
Thank you
 
Upvote 0
Top