Android Question Disable notifications programmatically

Discussion in 'Android Questions' started by Neojoy, Jul 25, 2019.

  1. Neojoy

    Neojoy Member Licensed User

    Hi, I would like to know if is possible disable notification from my app without open notification settings.

    I'm using the code below to check if it is on or off, any idea?

    Code:
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Do you want to disable your app notifications? Or notifications of other apps?
     
  3. Neojoy

    Neojoy Member Licensed User

    My app notifications. Is there some way in manifest file?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It should be trivial to avoid showing notifications based on some app setting. What is the problem?
     
  5. Neojoy

    Neojoy Member Licensed User

    My app record phone calls. When notifications settings is on and I make a phone call, a small icon and app name appears on notification bar on Android 8 and 9.

    So I need to set notifications off to my app stay invisible.

    How can I do this programmatically or using manifest file?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice