Android Question GCM Lollipop issue

jazzzzzzz

Active Member
Licensed User
Longtime User
My App have been working perfectly with push notifictions,but suddenly I got this errror in all lollipop and above devices..(in Kitkat Registration is successfully done)

B4X:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.c2dm.intent.REGISTER (has extras) }

this is my registration code

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 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)
    Log("bla")
    StartService(i)

End Sub

this is my manifest

B4X:
AddManifestText(<permission android:name="$PACKAGE$.permission.C2D_MESSAGE" android:protectionLevel="signature" />)
AddPermission($PACKAGE$.permission.C2D_MESSAGE)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
' Push Service Receiver Attribute
SetReceiverAttribute(Starter, android:permission, "com.google.android.c2dm.permission.SEND")
' Service Receiver Text
AddReceiverText(Starter,
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="$PACKAGE$" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="$PACKAGE$" />
</intent-filter>)

While searching internet about the issue I found this

http://blog.android-develop.com/2014/10/android-l-api-21-javalangillegalargumen.html

Can Some one help on this?
 
Top