Samsung Galaxy S4 Not Displaying Push Notifications from Parse.com - android

We're about to launch a new app on iOS & Android, using Parse.com to provide the push notification service.
We've been testing on 5 devices internally: iPhone, iPad, Galaxy Tab, Galaxy S3, Galaxy S4
Here is an example of one of the pushes:
{ "deal_id": "ad60b089-6678-42d9-a503-3525d0c8c065", "alert": "Reliable Rentals has a new deal available. Check your favourites now!", "sound": "default", "action": "SS" }
On iPhone/iPad/GalaxyTab/S3, when the push is received it plays the default alert sound and presents the notification on screen.
But for some reason the S4 does not display the push OR play a sound. I can only think of 2 explanations:
1) there is something wrong with the Parse code above
2) there is some setting on the S4 device that has disabled push notifications either for this app or completely
I am not an expert in either area (Parse or Android) so was hoping the community might know what I can do to troubleshoot further.
PS - first time StackOverflow poster. If my question doesn't meet the requirements of this forum I do apologise. Happy to schooled on how/when to use this forum!

I think the reason why push is not displayed can be connected with customizing your push. Maybe try to modify your push data.
You put sound parameter and action parameter. Official Parse documentation says:
*alert: the notification's message.
*badge: (iOS only)
*sound: (iOS only)
*content-available: (iOS only)
*category: (iOS only)
*uri
*title: (Android, Windows 8, & Windows Phone 8 only)
Also go to applicaition list in setting in your phone and find your app.
There should be option: Notifications -> enabled.
Hope it will help.

Since it works on other android devices , i doubt it is your code that is causing the problem
It could be that your app is not allowed to show notifications , Check that "show notifications" is enabled in settings Settings->Apps->your_app .

So you can try send this example push message:
JSONObject data = new JSONObject("{\"alert\": \"Message\",
\"title\": \"New push!\"}");
ParsePush push = new ParsePush();
push.setChannel("Mets");
push.setData(data);
push.sendPushInBackground();

Related

Phonegap/Android - Notification's sound and vibration does not play during a phone call

On an Android device, during a phone call, the notification sound does not play nor the vibration to let the user know about it.
Expected Behavior
Play the notification sound and the vibration pattern even if the user is having a phone call.
Reproduce Scenario (including but not limited to)
Using a smartphone start a phone call and push the notification, you'll see that you'll not hear the notification voice nor feel the vibration.
P.S. The vibration never trigger in all the cases.
Steps to Reproduce
1. Start a phone call
2. Push the notification, using the sample code that can be found below.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Android 6.0
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
Samsung Note 5
Cordova CLI version and cordova platform version
cordova --version
6.3.0
cordova platform version android
android 5.2.2
Plugin version
phonegap-plugin-push 1.8.0 "PushPlugin"
Sample Push Data Payload
N/A
Sample Code that illustrates the problem
data: {
sound: "default",
title: "New",
alert: "This is a new notification !",
soundname:"ringtone",
vibrate:true,
vibrationPattern: [2000, 1000, 500, 500],
priority: 2,
visibility: 1
}
Logs taken while reproducing problem
N/A
I think you can fix this but on the android phone solely, specifically its native settings. Try the following steps.
Here are the steps to configure the push notification sound setting during a Phone call (Android):
1. Go to dialer
2. Click on the "More" at the top right
3. Select Settings
4. Click Call Alerts and change Notify during calls setting.

Physical Web mDNS android test - advertising beacon app not displayed

I'm trying to replicate this RaspberryPI example on Android
I created an app for android to advertise a URL using mDNS (jmDNS library), the app works well and I can receive the message on another phone using ZeroConf Browser app
But when I try to receive the same message using Physical Web app nothing happens, the app doesn't find the service.
I believe the problem is in the way I send hostname and txt-records.
This is my code:
serviceInfo = ServiceInfo.create(type,
"www.google.github.io", 80,
"path=/physical-web/");
/*A Key value map that can be advertised with the service*/
serviceInfo.setText(getDeviceDetailsMap());
jmdns.registerService(serviceInfo);
can you help me understand what is wrong?
See these discussions:
https://github.com/openhab/jmdns/issues/25
https://github.com/google/physical-web/issues/414
In short, I think the issue is because the url is in a text record, rather than in the service name, but the Physical Web may change the required format in the future...mdns support is still developing.

How to check if Samsung Gear 2 is paired with Android device programmatically?

I am using Tizen SDK for Wearable from samsung-gear site in order to communicate a provider android application with Samsung Gear 2 device. I am able to send notifications to gear and once I run the consumer application on gear 2, I am able to transfer data between the watch and my Android phone as well.
What I am trying to do is to check within the Android application if the phone is paired with Gear 2. Something as simple as creating a communication object using the accessory service and calling a method like isPaired()?:
CommunicationObject commObject = new CommunicationObject(Communication parameters);
// I am assuming some connection call like commObject.connect() should be invoked first
// where I can check for it's result afterwards such as
if(commObject.isPaired())
{
// do something
}
I think SDK examples such as consumer/provider application they provide on their site already assume that the device is paired, hence they show how to transfer data between phone and the gear watch. Yet I am seeking something as simple as asking the phone if it's paired with a gear device, which should be the prerequisite for transferring the data, which is done automatically by Samsung Gear Manager I believe right now.
Note: For the case of example provider/consumer applications, one can just check if any connection is available using the code in them. But the data transfer connection enabled only when I manually start the consumer app from the gear device, otherwise it acts like gear device is not paired even though it is.
I believe this is not the most popular topic these days so I will post what I came up with as an answer although I doubt anyone will need it, without being perfect, it's the closest way I could get to my goal using the available documentation.
I should also mention that this slide helped me stay on track as well.
In my solution, there must be an active 2-way connection between the gear widget(consumer/.wgt) and the host side application(provider/.apk) as in the example application provided by Samsung(Hello Accessory) at all times, at least during the time where I wanted to check for the pairing condition. The documentation refers to it as:
Hello Gear is a simple application that consists of:
Host-side application(provider) : HelloAccessoryProvider.apk
Wearable-side Application(consumer) : HelloAccessoryConsumer.wgt (Web app)
See that both sides have some xml configuration and Android requires specific permissions which are explained in detail in Hello Gear documentation.
This 2 way communication is provided by the Samsung Accessory Framework on the network layer(through Samsung Accessory Protocol, SAP) given that both sides implement the same Accessory Service Profile, again, configured via the xml files on both ends(service name, channel id etc.).
Android side implements the protocol as a service, extending the SAAgent abstract class. Then the widget on gear side application(.wgt) can invoke the SAAgent callbacks and provider/consumer communication is handled through SASocket objects claimed on both ends over the predefined channel in the xml configuration files.
Please note that this communication has to be initialized on both ends, in my case I had to open the widget application once on Gear(I believe there should be a way to start the gear widget via an intent or notification, somehow, but I could not find yet) after the Android application has started, here started means that SAAgent service is up and bound to an Activity, being eligible to receive callbacks and send state messages to the rest of the application via broadcasts. Such as the number of active connections, or any data transmission between the gear socket and Android application can be done this way.
Note that if you don't have to transfer data between the gear widget and the Android application, you may just be OK with the notifications. The only requirement to send notifications to the Gear from Android applications seems to be that the Gear is paired with your phone and connected via Bluetooth. Then you can just send an intent as explained in more detail here in Section 6. All you need should be the permission:
com.samsung.wmanager.ENABLE_NOTIFICATION
and some metadata definition in your ApplicationManifest.xml file explained in the same section.
<meta-data
android:name="master_app_packagename"
android:value="com.example.gearMasterApp"/>
<meta-data
android:name="app_notification_maxbyte"
android:value="300 "/>
And here is the sample code for intent, in order to send notifications to the Gear:
public static final String ALERT_NOTIFICATION =
“com.samsung.accessory.intent.action.ALERT_NOTIFICATION_ITEM”;
public static final int NOTIFICATION_SOURCE_API_SECOND = 3;
Bitmap bitmapImg;
// Put data to Intent
Intent myIntent = new Intent(ALERT_NOTIFICATION);
myIntent.putExtra("NOTIFICATION_PACKAGE_NAME", “com.example.gearApp”);
myIntent.putExtra("NOTIFICATION_VERSION", NOTIFICATION_SOURCE_API_SECOND);
myIntent.putExtra("NOTIFICATION_TIME", System.currentTimeMillis(););
myIntent.putExtra("NOTIFICATION_MAIN_TEXT", “Title Text”);
myIntent.putExtra("NOTIFICATION_TEXT_MESSAGE", ”Body text);
byte [] byteArray = convertResizeBitmapToByte(bitmapImg);
myIntent.putExtra("NOTIFICATION_APP_ICON", byteArray);
myIntent.putExtra("NOTIFICATION_LAUNCH_INTENT", “com.example.gearMasterApp”);
myIntent.putExtra("NOTIFICATION_LAUNCH_TOACC_INTENT", “com.example.gearSideApp”);
sendBroadcast(myIntent);
public byte[] convertResizeBitmapToByte(Bitmap bitmap){
Bitmap scBitmap = Bitmap.createScaledBitmap(bitmap, 75, 75, false);
ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
scBitmap.compress(Bitmap.CompressFormat.PNG, 50, byteArrayStream);
return byteArrayStream.toByteArray();
}
Once the notification is read on the gear side, you can receive the intent action along with some optional parameters:
Intent Action :
"com.samsung.accessory.intent.action.UPDATE_NOTIFICATION_ITEM"
This could be another approach to check active communication with the Gear and your phone, but there is no guarantee that the notification will be read and my case did require to keep the Gear communication optional in order to allow the Android application continue it's tasks even though there is no active connection with the Gear.
About the original question, where I asked for a way to detect if the Gear is paired or not, I tried listing paired Bluetooth devices using getBondedDevices() method of Android's BluetoothAdapter but it shows that your Gear is paired even when your Gear is turned off, which was not enough for my needs and I did not find it logical. It's true though once your device is turned back on.
I'm happy with the above solution since it was enough for my needs, therefore I will accept my own answer.

Led not working on Android using Unified Push Notification of worklight (6.0.0.2)

I'm using the UPN system of Worklight Consumer Edition 6.0.0.2 to send push notifications.
When I receive a push notification no led light appears on Android. Why?
I tried on:
a Samsung S4 with Android 4.3;
a Nexus 5 with Android 4.4;
a Samsung S3 mini with Android 4.1.2 .
I use WL.Server.createDefaultNotification to build the notification payload:
var notificationObj = WL.Server.createDefaultNotification(notification.TITLE, badge,{});
notificationObj.GCM.sound="default";
and then I use notifyAllDevices to push:
WL.Server.notifyAllDevices(userSubscription, notificationObj);
I have the app closed and the screen is switched off.
The result is: I receive the push notification successfully and a sound is played, but no led at all.
The Notification priority API as provided by Android to allow for pulsing the notification LED (starting Android 4.1 "Jelly Bean" and above), is not available in Worklight.
If you'd like Worklight product designers to evaluate adding it to a future release, consider submitting a feature request.
AFAIK there is no way for a developer to extend support for this API in the application code, so there is no workaround.

Pushbot Android or IOS how to get a device to register for specific types of Messages

I have a question about PushBots(https://pushbots.com/). Sofar I have a basic Pushbot service working and all devices get notfications when they are sent out from the server.
However I would like to create types of messages which some devices may recieve and some may not. For example if it was a news application then I would like some devices to be able to register for Sports and Weather updates and receive message only for those topics.
I tried using TAGS to clasify messages but this did not, as all devices receive all messages regardless if it is using a TAG or not.
Does anyone have any idea how this can be done ?
Thanks !
in your app you need first to use the SDK to tag those devices before you are able to send messages to them.
Android Example:
Context appContext = getApplicationContext();
// tag the device with "tag"
Pushbots.getInstance().tag(appContext, "tag", null);
iOS Example
// Tag the device with "tag"
[[Pushbots getInstance] tag:#"tag"];
I hope this helps.

Categories

Resources