Android Question [SOLVED] Android PUSH notification

SlashIT

Member
Licensed User
Longtime User
Hi,

I have problems with the reception of push notifications ... I get only a simple message toastmessage and only when the device is turned on.

Why ??

I followed this tutorial and tried different systems of sending the message to the server Google, but the result is always the same: toastmessage (only when the device is turned on).

So I followed the advice of google and install the APP "Push Notification Tester" (free on google play) and everything works perfectly !! Notifications when the device is off; notifications when the app is not running ... why ??

Do you know why? someone has already solved?

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Question over questions but NO ONE LINE of code? Did you expect to get a solution from us without showing us your code?
 
Upvote 0

SlashIT

Member
Licensed User
Longtime User
Question over questions but NO ONE LINE of code? Did you expect to get a solution from us without showing us your code?
but why not READ POST before replying !! the code is the same as the link of the tutorial (hover your mouse over 'tutorial') ... let us not waste time if you do not know the answer (with USELESS answers)
 
Upvote 0

SlashIT

Member
Licensed User
Longtime User
I used the same example and it worked (and works) for me
thank you. mmm, very strange, I can register the device on the server google and get the id, transmit, always using the google servers, the push. The various devices and versions of OS use various methods to display the push? This would explain why I see a simple TOASTmessage. I am using a Nexus S and a galaxy tab gt-p3110
 
Upvote 0

SlashIT

Member
Licensed User
Longtime User
Where does the toast message come from? It probably comes from your service code.
Hi Erel,
I did some testing and this is the situation: i receive the push only when the application started, and not leave the device in standby; if I kill the APP (not close, kill), when I receive the push, the device reopens the App and always shows the toastmsg. I'm doing something wrong in the manifest example of the tutorial?
Manifest:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true" 
  android:normalScreens="true" 
  android:smallScreens="true" 
  android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

'C2DM Permissions
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>)
 
Upvote 0

SlashIT

Member
Licensed User
Longtime User
Solved!
at the tutorial for sending push, I added this other tutorial, changing the parameter '#StartAtBoot: True' of the modules 'PushService' and 'NotificationService'. The result is a full-service push notifications even with the app closed (killed)!
 
Upvote 0

SlashIT

Member
Licensed User
Longtime User
You don't need to set StartAtBoot. Once the user explicitly kills an app it will not start again until the user explicitly starts it. This means that if you kill it from the task manager it will not receive push notifications.
I did all the tests possible and when I kill the process of the app (Terminate on the application menu), and send a push, the system delivers. Opening the message from the push notifications, the program is also open. I did this test: I killed the App, turned off the phone, sent the push, start the phone (the next day) and the message was delivered to me without problems, and opening the message push, is also open the App .
 
Upvote 0
Top