freshplanet / ANE-Push-Notification

Air Native Extension (iOS and Android) for Push Notification
Apache License 2.0
205 stars 104 forks source link

Getting null data from GCM message #18

Closed woshikj closed 7 years ago

woshikj commented 11 years ago

I've been trying to get notifications to work for a few days and currently, only local notifications work but the notification font size is too big. I can only see the title and half the height of the message.

Messages sent from GCM just returns me data = null.

Any way to solve this issue?

I'm testing on Samsung Galaxy S3 running Android 4.1.1

Is there a way to have an icon for the notification?

Thanks.

woshikj commented 11 years ago

Okay i've solved the GCM data being nulled. But the notification font is too big for locally sent notifications using the sendLocalNotification method.

Notification Tray Icon is still unable to change to what i want. I see from the java side that it uses icon_status in the drawable folders but i cant seem to be able to change the image from AIR settings.

wongpv commented 10 years ago

Hi woshikj,

Can you provide me solution for GCM data being null.

Many thanks.

woshikj commented 10 years ago

Hello wongpv,

If you looked at the source code for the callback method that receives the GCM message, you'll be able to see this.

        CharSequence tickerText = intent.getStringExtra("tickerText");
        CharSequence contentTitle = intent.getStringExtra("contentTitle");
        CharSequence contentText = intent.getStringExtra("contentText");

Which means that your GCM message has to follow the same name for each content such as tickerText for the text you see on your status bar when you receive it and contentTitle for the title of the notification.

Hope it helps! :)

wongpv commented 10 years ago

Hi woshikj,

The solution that you provided work well. Many thanks. Please provide me solution display icon notification on status bar.

PushNotificationEvent.COMING_FROM_NOTIFICATION_EVENT, the e.parameters is null. Can you provide me solution for GCM e.parameters for PushNotificationEvent.COMING_FROM_NOTIFICATION_EVENT being null.

Android phone in onActivate ( Resume) mode, how I can received notification from PushNotificationEvent.COMING_FROM_NOTIFICATION_EVENT and the status bar will not display the notication?

Many thanks.

woshikj commented 10 years ago

Hello wongpv,

I've been trying to figure that out as well but so far i've found no solution yet.

If someone knows, please reply too! :)

Thanks!

ghost commented 10 years ago

Hi guys, my phone never received the local notifications, can someone give me an example ?

xangadix commented 10 years ago

For anyone still searching for a solution, Woshikj had the right direction, the json string needs a certain makeup to work, and here it is:

options = { data: { parameters: {param1: "these are parameters", param2: "even moar parameters"}, tickerText: "this goes in the top bar", contentTitle: "title of message", contentText: "text of message" }, collapse_key: "updated_score" }

the source that Woshikj is referring to is here: https://github.com/freshplanet/ANE-Push-Notification/blob/master/android/src/com/freshplanet/nativeExtensions/C2DMBroadcastReceiver.java

But how to add an icon to the notifications :-/