As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Hey Gary, I'm sorry for the delay on this. Our library owner is away at Google i/o this week.
G
Gary W
said
almost 9 years ago
Oh, I see I have a typo in my question. It should read.
"However, what can I put in androidPayload to cause it to play a sound and show a badge count like the APS does?"
The problem with the delay is I have two clients waiting for this to be implemented.
M
Michael
said
almost 9 years ago
Hi Gary,
Google Cloud Messaging (GCM) doens't work quite the same way as the Apple Push Notification Service (APNS). With GCM, you can send whatever payload you want and then you manage what you want to do in your native client code.
So for example, to play a sound:
```
try {
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
r.play();
} catch (Exception e) {
e.printStackTrace();
}
```
You can pass different values in the payload and play the appropriate sound based on what you pass, but the attribute you pass is up to you and not defined by Android.
G
Gary W
said
almost 9 years ago
But what if the app isn't running at the time of the push?
G
Gary W
said
almost 9 years ago
Maybe I should mention that the code runs fine when the app is running. I get the Push Received event and I then do a local notification and play a sound and I pull the server.
But when the app is not running the message in the push is displayed in the notification drawer, no sound, and I don't get the push received event UNTIL someone taps the notification. Which kind of defeats the whole point of a push, to alert someone when their phone is in their pocket or sitting on the desk.
M
Michael
said
almost 9 years ago
Can you provide the code for your class that extends KinveyGCMService, your broadcast receiver, and your application manifest section that contains the receiver entry?
G
Gary W
said
almost 9 years ago
Hi,
I'm using Rad Studio XE6. PushEvents is their Push object and uses their Kinvey provider.
The RAD Studio client library was independently developed by Embarcadero, so I don't have a whole lot of insight into its internals. The code that wakes up to play a sound, etc., is purely client side, so you may have to contact Embarcadero to resolve why it isn't specifically waking up when the app is not running. If you need further help with this, let me know.
G
Gary W
said
almost 9 years ago
Ok.
Can I take it that you don't see any problems with the manifest file?
M
Michael
said
almost 9 years ago
Not that I can see...
G
Gary W
said
almost 9 years ago
Ok, thanks. Still it's not working like it should. I posed a question on the Embarcadero forums and still no answer.
c
classic12
said
over 8 years ago
Hi Gary,
I am trying to get this working in delphi XE7.
Did you have any sucess ?
Do you have a link to the delphi forums where you posted.
Gary W
This seems to work, sort of:
However, what can I put in androidPayload to cause it to play a sound and show a badge count like the SMS does?
function onRequest(request, response, modules){
modules.logger.info('Starting=' + request.body.KinveyID);
var push = modules.push, collectionAccess = modules.collectionAccess;
var iOSAps = { alert: request.body.message, badge: request.body.count, sound: "default" };
var iOSExtras = '';
var androidPayload = {message: request.body.message };
collectionAccess.collection('user').findOne({ "_id": collectionAccess.objectID(request.body.KinveyID) }, function(err, user) {
if (user)
{
modules.logger.info('Pushing message to ' + request.body.KinveyID);
push.sendPayload(user, iOSAps, iOSExtras, androidPayload);
}
response.complete();
});
modules.logger.info('Ending');
}