Last edited:
Yes.Are you planning to post a tutorial about GCM?
Sub Process_Globals
Dim Package, DeviceBoardPassword, BoardUrl, SenderId, DeviceName As String
DeviceBoardPassword = "34f34fkj02d3"
BoardUrl = "http://b4aserver.basic4ppc.com/c2dm_board.php"
'both these fields should be set to match your application package and SenderId.
Package = "progetto-tecnomobileclienti58"
SenderId = "[email protected]"
End Sub
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'
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(PushService, android:permission, "com.google.android.c2dm.permission.SEND")
' Service Receiver Text
AddReceiverText(PushService,
<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>)
I haveHello,
When i tried to send a message, i got this result :
B4X:java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: https://android.apis.google.com/c2dm/send at anywheresoftware.b4a.c2dm.C2DM.sendMessageTo(C2DM.java:66) at anywheresoftware.b4a.c2dm.C2DM.sendMessageTo(C2DM.java:63) at anywheresoftware.b4a.c2dm.C2DM.main(C2DM.java:228)
this is a ClientLogin Auth token problem but i don't understand what i must do.
Do you know ?
Make sure that you entered the correct values in config.txt. Were you able to register the device successfully?
There should be a file named oauth.txt in the folder of the desktop tool. Delete it and see if it is recreated.
I have exactly the same problem. I verify the config.txt values, when I registered the device successfully and I deleted the oauth.txt file and when I re-started the app this file was created again. But I continue receiving the same error.
C2DM is no longer supported. You should switch to GCM: http://www.b4x.com/android/forum/threads/android-push-notification-gcm-framework-and-tutorial.19226/