phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Registered but not receiving push notifications on Samsung S8 and S8 Plus #2405

Open fgagneten opened 6 years ago

fgagneten commented 6 years ago

Our last release, we migrate this plugin from version 1.10.4 to 1.11.1.

Now, one of our client tell us that they are not receiving notification on Samsung S8 nor S8Plus (with the previous version of the plugin used to work perfectly).

The device of my client can register the registration id. I save the registration id in my database. But something change because they are not able to receive notification.

The others clients receive notification without problem (they use my app with other devices). Also we tested that release and notifications work like a charm.

Could me help me finding the solution?

Cordova version: 6.5.0 Ionic version: 2.2.2 Previous phonegap-plugin-push version: 1.10.4 Current phonegap-pkugin-push version: 1.11.1

fredgalvao commented 6 years ago

@fgagneten We would need to see some logs (logcat, from android) of a reproduction of the issue, otherwise this would be considered an anedocte (specially if it's only one of your clients that is experiencing this issue). Do you happen to have an Samsung S8/S8Plus to test it?

fgagneten commented 6 years ago

Sure, I understand. My client is from another province. It is difficult to get in touch with him. He tried with a Samsung S8 -> didn't receive the notification. After that, he tried with ANOTHER phone: Samsung S8 Plus -> didn't receive the notification neither

This is the only data I have from his mobile device:

Cordova version: 6.4.0 Model: SM-G950F SO: Android SO Version: 8.0.0

I don't have a Samsung S8 mobile phone to test it 😢

macdonst commented 6 years ago

@fgagneten Right, so the device is running Android 8.0 which means it uses the new Message Channels that Google introduced in Android O. You'll need to upgrade to plugin version 2.1.x or later to support Android O.

fgagneten commented 6 years ago

@macdonst I think this issue needs to be reopened. As I said before, My client has 2 phones, Samsung S8 and S8 Plus.

The S8 Plus phone has the following features: Cordova version: 6.2.3 Model: SM-G955F SO: Android SO Version: 7.0.0

As you can see, android version is 7.0 (Samsung S8 Plus) and he didn't receive the notification.

Thanks

macdonst commented 6 years ago

@fgagneten whelp, that's information I didn't have earlier. I can tell you with 💯 certainty your client won't receive push messages using Android 8 if your app is using push plugin 1.x.

As for why it is no working on the S8 Plus I'm can't tell you without seeing some logs.

jcesarmobile commented 6 years ago

Anyway, you should still try to migrate to 2.x.x as 1.x.x is old and won't get most of the fixes.

ggiordan commented 6 years ago

I ran into a similar issue, in my case it was less about the specific device (I have a Pixel) and more about the targeted SDK. When the target is 26, then 1.11.1 does not seem to work, when I back it off to 25, it does. I get what @macdonst is saying about the need to migrate. If I am correct, can a warning / error be emitted when 1.11.1 targets an SDK level that will be problematic?

Or is this a different issue?

devinvail commented 6 years ago

Its an SDK and not a device issue. According to Google, starting with sdk 26, you must use channels in notifications:

https://developer.android.com/training/notify-user/channels

Based on the plugin changelog, looks like channels support was added in version 2.1.0.

As far as I can tell so far, to fix this required channels issue, we have to:

// Create a channel (Android O and above). You'll need to provide the id, description and importance properties.
this.push.createChannel({
 id: "testchannel1",
 description: "My first test channel",
 // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
 importance: 3
}).then(() => console.log('Channel created'));

To get the warning toast about the missing channel property on an Android 8 sdk 26 device, do this:

Note: You can turn on a new setting in Android 8.0 (API level 26) to display an on-screen warning that appears as a toast when an app targeting Android 8.0 (API level 26) attempts to post without a notification channel. To turn on the setting for a development device running Android 8.0 (API level 26), navigate to Settings > Developer options and enable Show notification channel warnings.

Anyone have more detailed info than this? I still haven't got it working.

thanks

cleitonjar commented 5 years ago

@devinvail I understood. It is not possible to migrate to 2.x my clients use android 4.4 and "cordova 7" no longer supports, as per cordova requirements. I did the following I got the code that created a "default" channel from version 2.x and added in version 1.10.5. And it still did not work. If I get version 2.x and change the plugin.xml to support "Cordova 6.5" will it run successfully? Are there any restrictions?

lfreneda commented 5 years ago

@cleitonjar did you solve it? I'm facing the same situation here... cordova 6.5.0 :(