B4A Library NotificationListener library (NotificationListenerService)

Status
Not open for further replies.

susu

Well-Known Member
Licensed User
Longtime User
Here's the case:
I use CallLog.GetSince 8:00. There's no missed call. At 8:05 I have a missed call. CallLog.GetSince will return 1 missed call. At 8:10, I clear the notification and the missed call will be delete but CallLog.GetSince 8:00 still return 1 missed call. I need to run CallLog.GetSince 8:11 or so to get 0 missed call. That's why I need to use NotificationListener to know when the missed call was cleared. I don't know a better way to do it.

I forgot to mention, I use a service to run Callog.GetSince every 30 seconds.
 

pesquera

Active Member
Licensed User
Longtime User
Hi, I've using this wonderful library from a long time and working very good for catching whatsapp messages

Now, I'm having an issue that is intermittent.. sometimes the notification message is processed again, and sometimes is for several instances
After processing a notification I'm clearing it with ClearNotification(SBN)

Seems that the event Listener_NotificationPosted is fired again, without any income notification.. the same notification is processed again
How can I find the problem?

I've tested it with Android 6 and Android 5

the code that I'm using is that posted on #32
NotificationListener library (NotificationListenerService)


EDIT: I was thinking about some last code changes.. I conditionally do start the NotificationService, if the user profile has rights for whatsapp message processing
I have this on the starter service: (Service_Create)
B4X:
If loc_Perfil <> "Cliente/Paciente" And _
    ph.SDKversion >= 19 And _  ' Android 4.4+
    Not(loc_AHPManager.GetBoolean("miParam_App_Closed"))
        StartService(NotificationService)
End If
Could this be related?


and, I'm not sure.. is this right?
NotificationService
B4X:
#Region  Service Attributes
    #StartAtBoot: True
#End Region

Starter
B4X:
#Region  Service Attributes
   #StartAtBoot: True
   #ExcludeFromLibrary: True
#End Region
 
Last edited:

pesquera

Active Member
Licensed User
Longtime User
Thanks Erel, just another question:
I'm proccesing the messages with this line:
B4X:
Dim lines() As Object = extras.RunMethod("getCharSequenceArray", Array("android.textLines"))
   If lines<>Null Then
      For Each line As Object In lines
'         catch the message from the line
'         < ---------------  I want to delete the message catched here
I noticed that the message is queued and procceced again when another message is coming
It's possible to delete the line from that array, after catched?
 

deantangNYP

Active Member
Licensed User
Longtime User
May i know if its possible to wake up the screen and vibrate when Notification comes in (btnCreateNotifications_Click)?
 

Neojoy

Member
Licensed User
Longtime User
Hi, I've using this library, but NotificationListener stops after some times and show this error "java.lang.RuntimeException: Object should first be initialized (StatusBarNotification)".

When it happens my app crashes and go away

Any idea?
 

Neojoy

Member
Licensed User
Longtime User
Please check the logs and post the full error message.

This error occurs only on device, this is the only error message that I get, using Try and catch.

Is there another way to get full error message on device?
 

Neojoy

Member
Licensed User
Longtime User
Is there an way to close NotificationListener interface after turn on or bring to front my activity?
 

Neojoy

Member
Licensed User
Longtime User
Which interface are you asking about?

interface that turn on NotificationListener when I call "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"
I would like to force it disappear and back to my previous screen without press back button
 
Last edited:

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hello to all,
I should intercept the sending of an email and be able to read the email (recipient, object, and content) data to save the data to a table in the App.

Can anybody help me?

thank you
 

beelze69

Active Member
Licensed User
Longtime User
H
Hi!,

Suppose I need to check if the WhatsApp message has come from a particular Number and if that message has an attachment and then forward that attachment and the message automatically to specific email-id, how can that be done ?

Thanks
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…