-
Notifications
You must be signed in to change notification settings - Fork 1.9k
setApplicationIconBadgeNumber not working on Android but firing success function #1560
Comments
@oliverfogden I would not code it the way you are coding it as you could be messing up the value of
|
@macdonst thats a good heads up, the code was slightly different inside the app but was changed for the example. Running the code you have noted above results in the same symptoms: The success function fires but the badge is not updated. |
@oliverfogden that's cool. Just wanted to eliminate the potential obvious solution first. So this is:
|
@macdonst correct on all of the above. I'm fairly certain it was working on my Sony before upgrading it to 6, it was 5.1.1 before. As expected, the same code works in iOS 10.1.1 |
@oliverfogden ah, so when you upgraded from Android 5.1.1 to Android 6 it stopped working? But their test app still works with Android 6? |
@macdonst yes it seems to be the case, I can't downgrade so I can't double check but I'm fairly certain. I have removed and re-installed the app just in case, but no change. The test app works on Android 6 without any problems. |
@oliverfogden so weird considering I use ShortcutBadger to set the badge. I think you should open an issue on SB and refer to this one. |
@macdonst sure can do, as the IsBadgeWorking app seems to work, which runs ShortcutBadget 1.1.11 (which I think this plugin also uses?) and works, I'm afraid they are going to send me back here! |
@oliverfogden yeah, SB says to run IsBadgeWorking first. See what they say and we can proceed. Sadly, I don't have a device that I can reproduce this on. |
@macdonst the recommendation from ShortcutBadger seems to be to update ShortcutBadger... |
@oliverfogden apparently they released 1.1.12 four hours ago. I just upgraded the dependency. Can you try it and see if it fixes your issue? Just install directly from master:
|
@macdonst I've just removed the plugin, installed with the command above and run the previous code to set the badge. Same outcome, success callback fired but no badge. |
@oliverfogden kk, let's comment on SB |
@macdonst Wouldn't it make sense to switch back to SB 1.1.4 (before #1248)? I am experiencing problems on Samsung devices as well. They probably got fixed a few days ago (without a new version so I believe we cannot use it at the moment). But have a look at the issues in this repo - lately, there were many reports from users with completely different devices. Maybe, switching back to 1.1.4 and then (after some time) to a future release like 1.1.14 or 1.1.15 can prevent these problems? 😃 |
Hi, I have a Sony Xperia™ Z3 and the Badge has not showed. I can see the push.setApplicationIconBadgeNumber() function is called but I cannot see any badge. I'm working with phonegap/phonegap-plugin-push plugin. Could I do something to resolve this problem? Regards |
@MBuchalik can you try installing the latest push plugin from master as I upgraded to SB 1.1.13? |
@macdonst Unfortunately, this doesn't fix the issue. I tried the SB test app (IsBadgeWorking) that is running 1.1.13 and badges don't work here as well. (Maybe, this only happens on Samsung devices running Lollipop?) Do you have an idea what can be done to fix this? Btw: The success function does get fired when running push.setApplicationIconBadgeNumber(function() {
console.log("success");
}, function() {
console.log("error");
}, 1); I am using PGB and fetched the latest plugin version like this: <plugin name="phonegap-plugin-push" source="git" spec="https://github.com/phonegap/phonegap-plugin-push">
<param name="SENDER_ID" value="my sender ID" />
</plugin> |
@MBuchalik can you just drop the version of SB to 1.1.4 locally and see if it resolves the issue? |
@macdonst Sure! Using version 1.1.4 makes the badge work again on my Samsung Galaxy Alpha with Android 5.0.2.
|
…but firing success function Trying ShortCut badger v1.1.13
…but firing success function Reverting to ShortcutBadger v1.1.11
@MBuchalik Okay, I reverted to 1.1.11. Can you give it a try in master? |
@macdonst It seems to be working (at least on my device). I tried the actual push notification (badge in the payload over GCM) and the JavaScript setApplicationIconBadgeNumber() and both are working now 😃 Unfortunately, I only have one Android L device so I can't test it in other environments... |
@MBuchalik I'm going to leave it as is in master and hope for a new SB release soon. Sadly, I have no devices which can be used to test SB. |
@macdonst Thank you for this change - I hope that a new version of SB will be released soon. At the moment, 1.1.11 should fix the problems I had with Samsung. 😃 Are you planning to release this as a new version of phonegap-plugin-push so that it is possible to grab the changes from npm? (It's no problem if not - I just better like referencing actual version numbers instead of git commits :D) |
I would like to comment I have tested with IsBadgeWorking? app and I can see the badge. |
My application show the badge in other Android and iOS devices but not in Sony Z3. |
this is the plugin.xml of the push plugin. You can change the txt extension to xml. Could I try any thing more? |
@Jolete am I right that you are using PGB? Currently, you are using version 1.10.0 of the push plugin. Please use the latest version from master (for testing only): <plugin name="phonegap-plugin-push" source="git" spec="https://github.com/phonegap/phonegap-plugin-push">
<param name="SENDER_ID" value="your sender ID" />
</plugin> |
@Jolete any update? |
No. I have to try again... Let me time to test. |
PGB? |
I have cloned phonegap/phonegap-plugin-push and replace the code of the plugin. Badge is not showed in my Sony Z3. Could I try another thing? |
@Jolete As I said: Can you please try it with 4af3472? This uses shortcut badger 1.1.13 which should be the same as you can see in the IsBadgeWorking app. What do you mean with "replace the code of the plugin"? What does your config.xml (especially the part where you include the push plugin) now look like? I just want to make sure there is no issue with your configuration... |
I'm using the push plugin version 1.10.5. On 2 Android 6, not badge is ever visible. On Android 5, the badge is shown but never disappears. |
@Heshyo What Android 6 devices are you using? Are you sure that badges are supported here? Could you try https://play.google.com/store/apps/details?id=me.leolin.isbadgeworking ? |
@MBuchalik Moto G Play on 6.0.1. IsBadgeWorking doesn't work, I don't see any badge on the app. |
@Heshyo I don't see Motorola listed under "Supported launchers" (https://github.com/leolin310148/ShortcutBadger). Doesn't look like Shortcut Badger supports Motorola... Do you have badges on other apps like WhatsApp? |
@MBuchalik thanks, I thought badges existed on all Android versions.
|
@Heshyo You have to remove the badge when the application starts using setApplicationBadgeNumber with a count set to 0. See https://github.com/phonegap/phonegap-plugin-push/blob/v1.x/docs/API.md#pushsetapplicationiconbadgenumbersuccesshandler-errorhandler-count---ios--android-only |
@MBuchalik thanks but I have |
@Heshyo OK, I have never used clearBadge. According to the docs, the iOS clear badge setting clears the badge when starting the app. The Android one clears the badge before processing notifications and "on init". So I assume you have to call the init function every time the app starts. Do you do this? If no, could you try it? If yes, I cannot really help you at this point. You should probably create a new issue for that and add some details about your configuration. |
@MBuchalik I do call |
@Heshyo Yup, seems so. You should probably create a new issue for that - then it is more likely that it will be seen by someone who has experienced the same problem and/or can help you with that. |
@macdonst was a release made for this fix? Having the same issue. |
i have same issue using sony E6653. it occur error and i think this related to leolin310148/ShortcutBadger#175 |
@macdonst changing gradle dependencies to |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This thread has been automatically locked. |
Expected Behaviour
setApplicationIconBadgeNumber to update the badge count on both Android and iOS.
Actual Behaviour
setApplicationIconBadgeNumber does not update the badge count, but fires the success callback on android. iOS works. I have downloaded isBadgeWorking which does does update the badge count
Reproduce Scenario (including but not limited to)
Add plugin, run code through remove devices in chrome
Steps to Reproduce
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Android 6.0.1
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
Sony E6653
Cordova CLI version and cordova platform version
Plugin version
Sample Push Data Payload
NA
Sample Code that illustrates the problem
See above.
Logs taken while reproducing problem
02-01 11:58:22.958 478-690/com.my.app V/PushPlugin: execute: action=init
02-01 11:58:22.964 478-691/com.my.app V/PushPlugin: execute: data=[{"android":{"senderID":"XXXXX","icon":"transparent"},"ios":{"alert":"true","badge":"true","sound":"true","categories":{}}},"windows":{}}]
02-01 11:58:23.065 478-691/com.my.app V/PushPlugin: execute: jo={"senderID":"1096839433110","icon":"truck_transparent"}
02-01 11:58:23.066 478-691/com.my.app V/PushPlugin: execute: senderID=1096839433110
02-01 11:58:23.075 478-691/com.my.app V/PushPlugin: onRegistered: {"registrationId”:”XXXXX”}
02-01 11:58:23.075 478-691/com.my.app D/PushPlugin: no iconColor option
02-01 11:58:24.347 478-691/com.my.app V/PushPlugin: setApplicationIconBadgeNumber: data=[{"badge":2}]
02-01 11:58:24.567 478-478/com.my.app D/SystemWebChromeClient: file:///android_asset/www/assets/myapp.js: Line 6490 : Updated badge
02-01 11:58:24.567 478-478/com.my.app I/chromium: [INFO:CONSOLE(6490)] "Updated badge", source: file:///android_asset/www/assets/myapp.js (6490)
The text was updated successfully, but these errors were encountered: