Android Question GCM - Unable to Start Service Intent {act = com.google.android.c2dm.Intent.Register (has extras)}

ashton293

Member
Licensed User
I am trying to register a client on Google Cloud Messaging.

I notice from this forum and others on the internet that this is a frequent issue.

I have tried just about all of the solutions I've been able to find - without success.

I have attached:
  • Manifest Editor pages from B4a
  • Copies of relevant log pages - ie where GCM processes occur.
  • Relevant sections of the various module pages from B4a.
I would appreciate someone having a quick look at what I have provided and see if they can identify what I may have incorrect.

Thank you.
Android Manifest Editor page 1.png
Android Manifest Editor page 2.png
Android Manifest Editor page 1.png Android Manifest Editor page 2.png Register Device code on Push Service.png Subs to register on RegisterGCM.png Log page 2.png Log page 1.png Android Manifest Editor page 1.png Android Manifest Editor page 2.png Register Device code on Push Service.png Subs to register on RegisterGCM.png Log page 2.png Log page 1.png
 

ashton293

Member
Licensed User
Hi Erel,

The error message is:

Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTER (has extras) }: not found

I hope that helps.

Regards.
 

ashton293

Member
Licensed User
Thank you Erel.

I have attached the full error log before amending the Register Device code [to that in post 302375] together with the full error log after changing the Register Device code.

I have changed the colour of the "Unable to Start" intent messages to Red to make it easier for you.

I note that after changing the Register Device code I now receive two "Unable to Start Intent" messages as well as a much longer log.


I have deleted input data and changed the actual file name to "example" and changed the module names to Module 1, Module 2, etc. Apart from those amendments the logs are complete.

I very much appreciate your assistance
 

Attachments

ashton293

Member
Licensed User
Thank you Erel.

Unfortunately, compiling in Release mode didn't work.

I will work my way through the log and see if I can identify and isolate the specific issue and hopefully resolve the problem.

Thanks again.
 

bermooda

Member
Licensed User
Hi.I had this error .but used below code and resolved


B4X:
Sub RegisterDevice (Unregister As Boolean)
   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)
End Sub
 

ivan.tellez

Active Member
Licensed User
Well, this is silly,
I notice from this forum and others on the internet that this is a frequent issue.

I have tried just about all of the solutions I've been able to find - without success.
Configured all last week and worked, today opened the app and crashes with this error. Search the forum and no answers.

Well, it looks like this error was because the server was not running o_O

Jus started the Push Server, wait a couple of minutes and try the app, all fine. So, just add a TRY to the code to tay safe.


B4X:
Sub RegisterDevice (Unregister As Boolean)
    Try
        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)
    Catch
        'Error Registering Device, Server Maybe Offline
        If LastException.IsInitialized Then Log(LastException.Message)
    End Try
End Sub
:D
 
Top