Expandable GCM push `notification` from server side - android

First of all, I have searched for a solution to my problem, but found none. Maybe it's too obvious or I am bad at searching. If it's so I am sorry.
Problem:
When sending GCM push notifications from server to mobile and supporting iOS, I must send a notification tag. This notification tag means the android system does not awake my application to handle the notification and does it itself. Even if I send data tag too.
My problem is when I try to make the app expandable. I know how to make it from code, but don't know how to set it from server side like the icon or color.
Question:
Is it any way to set notification as expandable (big view style) from server? If it's not, can I force the system to awaken my app to handle the notification?

With iOS there is a separate tag you need to have in your payload to so that you can get what you want on both platforms
if you look at the documentation you will see there is a tag content-available and when you use this tag it acts similar to how adding only the data tag in android would, you get the push in background vi the application:didReceiveRemoteNotification:fetchCompletionHandler: in your app delegate class.
There is where you would create the notification manually like you would on android

Related

Avoid autonotification display from GCM using notificacion push in Android

As we know, developing on Android we can handle push notification and show a custom view depending on our logic. But there is a problem, if I send a push notification with a content and title from the server android will auto-display the notification and if I handle them at the same time the phone shows both, mine and the auto-displayed.
How can I disable auto display of the notification in these cases.
Why do I need to do this?
I am using OneSignal to send push notifications for both android and ios. The second one need to receive a content and title to be shown but this is not mandatory for android and I want to be able to show a custom view in this case.
Thanks in advance
You can omit the displaying of the OneSignal notification by the SDK by setting up a NotificationExtenderService per the OneSignal Background Data and Notification Overriding documentation. Use the NotificationExtenderBareBonesExample class example shown in step 2 and return true instead of false to let the SDK know your handling the notification.

Make GCM notification open app without setting click_action

Okay, so I know at first glance it seems like I'm stupid because I can just set the "click_action" parameter in the notification JSON from the server and have it open the activity with the matching intent filter. However, I don't want to do this, because as the documentation goes on to say "If set, [click_action] corresponds to category in APNS payload," and setting it makes the notifications not be delivered on my iOS app (because there is no corresponding category on the iOS app nor do I want to make one as that requires, I believe, adding in notification actions which I don't want to get involved in yet).
On iOS tapping the notification just opens the equivalent of the Android "android.intent.category.LAUNCHER" action. Bottom line, is there any way to replicate this in Android (or solve the iOS not displaying notifications if the "click_action" is set)?
In GCM intent class, on Message receive method just parse all the content and then simply start activity by putting inside intent, which activity you want to open on msg received.
I'd suggest using different payloads for Android and iOS clients. This would require your clients to identify their platform when they submit their InstanceID tokens, but once you know what platform the client is you can formulate the message more specific to the target platform.

Pushwoosh Android notification is replaced when new come

I am using pushwoosh to send notification from server to devices. And that is working without any problems. Also it is worth mentioning that I am using phonegap/cordova. This problem is only related for android, ios does not has this problem.
Problem is when I send few notifications in short time only one is displayed in android notification area. On notification handle in my code all notification are received. Notifications do not have same title or text.
You need to enable multi-notifications for Android. Look for "setMultiNotificationsMode" here:
https://github.com/Pushwoosh/pushwoosh-android-sdk/blob/master/Documentation/PushManager.md#setmultinotificationmode
You need to enable multi-notifications for Android.
PushManager.setMultiNotificationMode(context);

Rich parse messages with push notifications service

I'm using Parse service in an application I'm developing, push notifications are now working, I can send perfectly ...
But I want to implement some actions in determidos cases example: Send url to be opened as soon as the user clicks on the notification, make a call, open the map with a planned route, and more.
I wonder if this is possible, and if we had someone who already knows the way I should go.
Thanks!
You can certainly send additional information to trigger an event inside your app, such as url opens, opening maps, etc.
First, you need to send a payload with your push notification that tells the app what to do. You can learn about that here:
https://parse.com/docs/push_guide#options/Android
Second, you need to create a handler inside your Android app that recognizes your push payload and knows what to do with it. You can find the appropriate start under "Responding with a Custom Activity" here:
https://parse.com/docs/push_guide#receiving-responding/Android

Is it possible to fake an incoming SMS on Android?

In a certain situation, I'd like my app to be able to "fake" an incoming SMS on the user's device, as a sort of notification. This would save me money when I'd normally use Twilio to send a text to my users but I know they already have my app. Is there any way to do this? I imagine it would have something to do with Intents and Content Providers but I don't really know where to start.
To clarify:
I'm not new to Android and I do respect all of the normal Notification methods. However, my app will have an opt-in for text messages and I'd like to be able to trigger them for free rather than paying for it. This is for SMS-specific uses and not as a substitute for a normal Notification.
Yes (although I really don't support doing this) it is, in theory possible by creating and broadcasting the proper intent. Specifically, they android.provider.Telephony.SMS_RECEIVED intent will be received by anybody who is listening for SMS messages, including the default SMS application. This will in turn cause the notification to be displayed.
All of that said, I've only ever done this in a custom version of Android from within the system process. I'm really not sure if a generic application can do this (in fact, I kinda doubt it). The other caveat is that you will need to formulate your data into PDU's which represent the binary data format of an SMS message. You can look this up, but it's nontrivial.
A far better approach would be to simply have your application display a notification in the tray, the way well behaved applications are supposed to notify the users of events. Take a look at the Notification class.
If you install the apk named ApiDemos-debug.apk that usually comes installed with your choosen platform for the SDK, you will find an example in
<Api Demos> > App > Notification > IncomingMessage
the complete source for this package is usually under
<SDK root>/samples/android-xx/ApiDemos

Categories

Resources