Android Question Firebase Messaging Token not received

Inrenbang

Member
Licensed User
Hi,

i am copying from my working former app that using Firebase Messaging, change app package, create firebase project, testing the app but token never receive nor the message i tested.

my FirebaseMessaging

FirebaseMessaging:
Sub Process_Globals
    Private fm As FirebaseMessaging
    Private sql1 As SQL
End Sub

'Called when an intent is received.
'Do not assume that anything else, including the starter service, has run before this method.
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
    If FirstTime Or fm.IsInitialized = False Then
        fm.Initialize("fm")
    End If
    sql1.Initialize(File.DirInternal,"main.db",True)
    fm.HandleIntent(StartingIntent)
End Sub

Public Sub SubscribeToTopics
    Log("subs topic")
    fm.SubscribeToTopic("sigi_sispeg_broadcast") 'you can subscribe to more topics
    Do While fm.Token = ""
        Log("waiting")
        Sleep(1000)
    Loop
    Log(fm.Token)
End Sub

Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
   
    If checkTableexist("pesan") Then
        Dim logo As Bitmap = LoadBitmapResize(File.DirAssets, "single-icon.png", 24dip, 24dip, True)
        Dim n As NB6
        n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(logo).AutoCancel(True)
        Dim cs As CSBuilder
        n.BigTextStyle(Message.GetData.Get("title"), cs.Initialize.BackgroundColor(Colors.Red).Append("").PopAll,Message.GetData.Get("body"))
        n.Build(Message.GetData.Get("title"), "", "tag",pesan).Notify(1)  
        sql1.ExecNonQuery2("insert into pesan (judul,isi) values (?,?)",Array As Object(Message.GetData.Get("title"),Message.GetData.Get("body")))
    End If
End Sub

Sub fm_TokenRefresh (Token As String)
    Log("TokenRefresh: " & Token)
End Sub

Public Sub checkTableexist(tbname As String) As Boolean
    Dim rset As ResultSet = sql1.ExecQuery2("select name from sqlite_master where name=?",Array As String(tbname))
    Dim hasil As Boolean
    If rset.RowCount > 0 Then
        hasil = True
    Else
        hasil = False
    End If
    rset.Close
    Return hasil
End Sub

the logs always show "waiting" no matter how long i wait, any tought?
 

Inrenbang

Member
Licensed User
1. Do you see the token in the device logs?
2. Post the device logs and the B4J logs.
1. No
2.
Device Log:
Logger connected to: emulator-5554
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
*** Receiver (firebasemessaging) Receive (first time) ***
subs topic
waiting
update db ver
init schedule notification
minggu set senin
*** Service (httputils2service) Create ***
(Http client initialized with accept all option.)
** Service (httputils2service) Start **
waiting
** Activity (main) Pause, UserClosed = true **
** Activity (login) Create (first time) **
** Activity (login) Resume **
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting
waiting

B4J Log:
[jobname=fcm, success=true, username=
, password=, errormessage=, target=class b4j.example.main
, taskid=1, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@6f96c77, response=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpResponse@be64738
, tag=java.lang.Object@3ba9ad43, invalidurl=https://invalid-url/, defaultscheme=https
, main=null, httputils2service=null]
{"message_id":8673522687185445550}
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…