Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
Contributor
fiksik
Posts: 10
Registered: ‎02-14-2013
My Device: Z10

Re: Push notifications with Urban Airship

Hi nl4pv,

 

We found that the exeption we're getting appears only if GCM is disabled in UA. So we set up a GCM on the UA admin panel and inside the app. And we're sending notifications through BB Service (at the moment just broadcast notifications).

 

As you also are able to get nofication:

I/PushIntentReceiver(17969374): Push Notification Extra: [data : word]

You can extract that value from JSON and show a notification by using Android API.

It will be shown on the BB Hub and it'll have a default "Alarm" icon(as a notification "Development mode enabled", but the title and text will be as expected.

So think like a data, that you've got from a JSON service and then showed as a notification.

 

Please also note, that we updated our device to OS version 10.0.10.261.

Hope that helps.

 

If you have any questions, I'll try to help you.

Contributor
nl4pv
Posts: 10
Registered: ‎02-19-2013
My Device: All of them

Re: Push notifications with Urban Airship

In UA, I only have BB and GCM enabled. And, I know GCM is setup correctly because I've tested my Android app.

 


fiksik wrote:

 

As you also are able to get nofication:

I/PushIntentReceiver(17969374): Push Notification Extra: [data : word]

You can extract that value from JSON and show a notification by using Android API.

It will be shown on the BB Hub and it'll have a default "Alarm" icon(as a notification "Development mode enabled", but the title and text will be as expected.

So think like a data, that you've got from a JSON service and then showed as a notification.

 

Please also note, that we updated our device to OS version 10.0.10.261.


Are you saying that you have written special case code for the BB 10 to look at the data extra and display an alert from that?

 

As for OS, I'm going to try upgrading to the latest version.

Contributor
nl4pv
Posts: 10
Registered: ‎02-19-2013
My Device: All of them

Re: Push notifications with Urban Airship

fiksik, can you please answer my question above?

Contributor
fiksik
Posts: 10
Registered: ‎02-14-2013
My Device: Z10

Re: Push notifications with Urban Airship

Yeah, sure.

 

Here is the code:


notificationManager =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
myNotification = new Notification(R.drawable.icon,
"Notification!",
System.currentTimeMillis());
String notificationTitle = "Title";
// Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(myBlog));
Intent intent = new Intent(context, SplashActivity.class);
intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.setComponent(new ComponentName("xxx","xxx.other.SplashActivity"));

PendingIntent pendingIntent
= PendingIntent.getActivity(context,
0, intent,
Intent.FLAG_ACTIVITY_NEW_TASK);
myNotification.defaults |= Notification.DEFAULT_SOUND;
myNotification.flags |= Notification.FLAG_AUTO_CANCEL;
myNotification.setLatestEventInfo(context,
notificationText,
"",
pendingIntent);
notificationManager.notify(MY_NOTIFICATION_ID, myNotification);

However, our notifications stopped working. We're getting an error: "GCM service is not available"
I don't know what can be the problem...
Contributor
nl4pv
Posts: 10
Registered: ‎02-19-2013
My Device: All of them

Re: Push notifications with Urban Airship

[ Edited ]

Thanks

 

So, in other words, you have added code to account for the Urban Airship library not creating the notification automatically like it does when run in a normal Android environment. This is something I would rather not do.

Contributor
fiksik
Posts: 10
Registered: ‎02-14-2013
My Device: Z10

Re: Push notifications with Urban Airship

We didn't add it to the UA library. We added it to our project. But, yeah, I agree that it should work without modifying the code. I'd like to have a sample app from UA, where their notifications work with Android Runtime on BB10.
Contributor
nl4pv
Posts: 10
Registered: ‎02-19-2013
My Device: All of them

Re: Push notifications with Urban Airship

Response from UA:


Thanks for your question regarding sending pushes to Android apps running on BB10. Unfortunately, we do not support that functionality at this time. We do support native Android and Blackberry push notifications, which I realize is not what you are asking, but I wanted to clarify what we do and do not support.
Contributor
kikyoung
Posts: 10
Registered: ‎03-15-2013
My Device: BlackBerry 10 Dev Alpha B

Re: Push notifications with Urban Airship

Hi.. nl4pv,

Thank you for sharing the answer from UA. We are also using UA to get the Android GCM push notification for our app on Android Market.

How did you get the answer?? And What is the alternative of UA?? Are you using BlackBerry Push Service server or gave up??

Thanks in advance :smileyhappy:
Contributor
nl4pv
Posts: 10
Registered: ‎02-19-2013
My Device: All of them

Re: Push notifications with Urban Airship


kikyoung wrote:

How did you get the answer?? And What is the alternative of UA?? Are you using BlackBerry Push Service server or gave up??

I created a support ticket on UA's site. We are not currently looking at alternatives and are giving up for the time being. You could do what kiksik suggested here as a workaround.

 

Developer
ryansweny
Posts: 64
Registered: ‎07-15-2008
My Device: Z10

Re: Push notifications with Urban Airship

I would love to get to the point where it is receiving the notification but it is not properly formatted and has extra headers.

 

To the original poster nl4pv, were you sending that via Android GCM or BlackBerry Push server?