Hello, I would like to introduce you to my new auto-response library for social networks, compatible with whatsapp, telegram works in the background

A good part of the code was recovered from the NotificationListener library I made some modifications to adapt to my project and I'm making available to you the example and the ReplyAuto.rar library.

Sorry for my English, I'm Brazilian and I'm in love with Basic4Android. no more conversations Let's go to the example.

Important minSdkVersion="14" AND android:targetSdkVersion="29"


Manifest:
AddApplicationText(
<service android:name="b4a.jsaplication.com.br.ReplyAuto"
    android:label="ReplyAuto"
          android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
     <intent-filter>
         <action android:name="android.service.notification.NotificationListenerService" />
     </intent-filter>
 </service>)


B4A:
Sub ReplyAuto_NotificationPosted (SBN As StatusBarNotification)
    'Log(SBN.Id) 'get Id Notification
    'Log(SBN.PackageName) 'get PackageName Application posted Notification
    'Log(SBN.Notification) 'get Notification object
    'Log(SBN.Extras)  'get extras Notification
    'Log(SBN.ContentIntent) 'get ContentIntent not used
    'Log(SBN.Key) 'get Key
    'LogColor(SBN.Title, Colors.Green)
    'LogColor(SBN.Message, Colors.Green)
    
    If SBN.PackageName == "com.whatsapp" Then
        Dim whatsappkey As String = SBN.Key
        Dim ww() As String = Regex.Split("\|", whatsappkey)
        If ww(3) <> "null" Then
            'rp.ClearNotification(SBN)
            rp.reply(SBN.Notification, SBN.PackageName, "Reply HelloWorld WhatsApp")
            Log("Reply Whatsapp Success")
        End If
    End If
    

    If SBN.PackageName == "com.whatsapp.w4b" Then
        Dim whatsappkey As String = SBN.Key
        Dim ww() As String = Regex.Split("\|", whatsappkey)
        If ww(3) <> "null" Then
            'rp.ClearNotification(SBN)
            rp.reply(SBN.Notification, SBN.PackageName, "Reply HelloWorld WhatsApp-Business")
            Log("Reply Whatsapp Success")
        End If
    End If
    
    If SBN.PackageName == "org.telegram.messenger.web" Then
        Dim telegramkey As String = SBN.Key
        Dim tt() As String = Regex.Split("\|", telegramkey)
        
        If tt(2).Length <> "1" Then
            rp.reply(SBN.Notification, SBN.PackageName, "Reply HelloWorld Telegram")
            Log("Send Telegram Success")
        End If
    End If
    
    If SBN.PackageName == "org.telegram.messenger" Then
        Dim telegramkey As String = SBN.Key
        Dim tt() As String = Regex.Split("\|", telegramkey)
        
        If tt(2).Length <> "1" Then
            rp.reply(SBN.Notification, SBN.PackageName, "Reply HelloWorld Telegram")
            Log("Send Telegram Success")
        End If
    End If
    

End Sub
 

Attachments

  • ReplyAuto Library.rar
    16.9 KB · Views: 241
  • ReplyAuto.zip
    9.5 KB · Views: 222

cheveguerra

Member
Licensed User
Longtime User
I don't think so, because you are replying to a notification and it only accepts text replies.
It is an Android restriction.
 
Hi, this is very useful. Specially after Meta's new policies.

Is it possible to receive and save photo/files/audio/location? And also send them?

Oi, isto será muito útil. Especialmente depois das noves políticas da Meta.

É possível receber e salvar fotos/arquivos/audio/localização? E também tem como enviá-los?
at the moment there is no way to save or send files but i am working on the library and adding some new functions
 

cheveguerra

Member
Licensed User
Longtime User
Hi, this is very useful. Specially after Meta's new policies.

Is it possible to receive and save photo/files/audio/location? And also send them?

Oi, isto será muito útil. Especialmente depois das noves políticas da Meta.

É possível receber e salvar fotos/arquivos/audio/localização? E também tem como enviá-los?
You can receive stickers, location and images, but you can only access the text of the notification, in the case of location you only get a "pin" icon and the text "location", when receiving a sticker you get another icon an "sticker" or "GIF" as text and so and so!.

receive a gif -> 👾 GIF
receive a sticker -> 💟 Sticker
receive location -> 📌 Location
receive a photo -> 📷 Photo
 
Top