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

Discussion in 'Android Questions' started by ashton293, May 25, 2015.

  1. ashton293

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the error message as text (right click to copy it)?
     
  3. ashton293

    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.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. ashton293

    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
     

    Attached Files:

  6. Erel

    Erel Administrator Staff Member Licensed User

    Compile your app in Release mode instead of debug mode.

    At some point the process is killed and later when the OS tries to restart it (when the message arrives) it fails because there is no attached debugger.
     
  7. ashton293

    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.
     
  8. bermooda

    bermooda Member Licensed User

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


    Code:
    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
     
    gudino jose luis and ashton293 like this.
  9. ivan.tellez

    ivan.tellez Active Member Licensed User

    Well, this is silly,
    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.


    Code:
    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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice