Android Question Firebase Notification

Ale_resource

Member
Licensed User
Hi , i followed the tutorial at https://www.b4x.com/android/forum/t...-messages-firebase-cloud-messaging-fcm.67716/ , but when compile the app i have this error :

the manifest is :
Manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
'********* TabStrip ***********************
CreateResource(drawable, background_tab.xml,
<selector xmlns:android="http://schemas.android.com/apk/res/android"
   android:exitFadeDuration="@android:integer/config_shortAnimTime">
  <item android:state_pressed="true" android:drawable="[USER=45325]@Color[/USER]/background_tab_pressed" />
  <item android:state_focused="true" android:drawable="[USER=45325]@Color[/USER]/background_tab_pressed"/>
  <item android:drawable="@android:color/transparent"/>
</selector>)
CreateResource(values, colors.xml,
<resources>
  <color name="background_tab_pressed">#6633B5E5</color>
</resources>)
'******************************************
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)

FirebaseMessaging Service:
#Region  Service Attributes
    #StartAtBoot: False
    
#End Region

Sub Process_Globals
    Private fm As FirebaseMessaging
End Sub

Sub Service_Create
    fm.Initialize("fm")

End Sub

Public Sub SubscribeToTopics
    fm.SubscribeToTopic("general") 'you can subscribe to more topics
End Sub

Sub Service_Start (StartingIntent As Intent)
    If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
    Sleep(0)
    Service.StopAutomaticForeground 'remove if not using B4A v8+.
End Sub

Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
    Dim n As Notification
    n.Initialize
    n.Icon = "icon"
    n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
    n.Notify(1)
End Sub

Sub Service_Destroy

End Sub

I made all the recommended updates on sdk manager
I also attach the AndroidManifest

what am I doing wrong ?
 

Attachments

  • AndroidManifest.xml
    9.2 KB · Views: 267

Ale_resource

Member
Licensed User
Please copy and paste the error log in text format.
where can I find an error log? in the ide I do not see anything .... the app crashes and I do not see anything

if i remove this line from manifest
s:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
the app start and work , else the app crash
immediately
 
Last edited:
Upvote 0

Ale_resource

Member
Licensed User
I tried to remove this line from the manifest
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
and now the app starts but i have this log :
 
Last edited:
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hello @Ale_resource

Look at the following link and follow the steps: https://www.b4x.com/android/forum/threads/solved-firebasenotifications-error-in-b4a.116626/

The solution to the error was the SDK, for this download the following:

1. Android SDK Command line tools. https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip
2. Required resources. https://b4xfiles-4c17.kxcdn.com/b4a/resources.zip

After downloading and unzipping DOES NOT update the SDK

You inform me if the error is solved
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I tried to remove this line from the manifest
These lines should not be remove.
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
Can you upload the zip file of your project?
 
Upvote 0

asales

Expert
Licensed User
Longtime User
You tested this code on a device with which android version?
I have similar problem (other lib) in devices with < Android 5.0
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…