Hi,
Based on Erel's tuto, I'm trying to run the example code (https://www.b4x.com/android/forum/t...otification-gcm-framework-and-tutorial.19226/)
I've registered GCM in google API for my project
I've updated SenderId with mine in B4A code.
With the original code, I get this error:
I've updated sub "RegisterDevice" with Erel's code proposal:
and the error became "Not found" on jobdone result.
I ran both code on emulator and real device.
I really don't know what to do ...
Any idea ?
Based on Erel's tuto, I'm trying to run the example code (https://www.b4x.com/android/forum/t...otification-gcm-framework-and-tutorial.19226/)
I've registered GCM in google API for my project
I've updated SenderId with mine in B4A code.
With the original code, I get this error:
Service Intent must be explicit: Intent { act=com.google.android.c2dm.intent.REGISTER (has extras) }
I've updated sub "RegisterDevice" with Erel's code proposal:
B4X:
Dim i As Intent
If Unregister Then
i.Initialize("com.google.android.c2dm.intent.UNREGISTER", "")
Else
i.Initialize("com.google.android.c2dm.intent.REGISTER", "")
i.PutExtra("sender", Main.SenderId)
End If
Dim jo As JavaObject = i
jo.RunMethod("setPackage", Array("com.google.android.gms"))
Dim r As Reflector
Dim i2 As Intent
i2 = r.CreateObject("android.content.Intent")
Dim pi As Object
pi = r.RunStaticMethod("android.app.PendingIntent", "getBroadcast", _
Array As Object(r.GetContext, 0, i2, 0), _
Array As String("android.content.Context", "java.lang.int", "android.content.Intent", "java.lang.int"))
i.PutExtra("app", pi)
StartService(i)
and the error became "Not found" on jobdone result.
I ran both code on emulator and real device.
I really don't know what to do ...
Any idea ?