Migrating from API 26 to 29 I noticed strange behavior in my app.
No reason a notification appears permanently (cannot be deleted)
I use Firebase notifications, but no messages have been sent to the app.
My FirebaseMessaging.b4a
Sub called in fm_MessageArrived
My Manifest
B4A 9.01.2
FirebaseNotifications lib 1.21
No reason a notification appears permanently (cannot be deleted)
I use Firebase notifications, but no messages have been sent to the app.
My FirebaseMessaging.b4a
B4X:
Sub Process_Globals
Public fm As FirebaseMessaging
End Sub
Sub Service_Create
fm.Initialize("fm")
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic("pedidoacaigoods_android_main")
Log(fm.token)
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized And fm.HandleIntent(StartingIntent) Then Return
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
CallSub3(Main, "msgPush", Message.GetData.Get("title"), Message.GetData.Get("body"))
End Sub
Sub called in fm_MessageArrived
B4X:
Sub msgPush(titulo As String, msg As String)
Msgbox(msg, titulo)
End Sub
My Manifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
AddApplicationText(
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />)
SetActivityAttribute (Main, android:exported, "true")
SetActivityAttribute (Main, android:taskAffinity, "")
SetActivityAttribute (Main, android:theme, "@android:style/Theme.DeviceDefault.Light")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
' fix api 29
SetApplicationAttribute(android:usesCleartextTraffic,"true")
'End of default text.
'Localizacao
AddPermission (android.permission.ACCESS_FINE_LOCATION)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
B4A 9.01.2
FirebaseNotifications lib 1.21