Closed SamJWeissman closed 5 years ago
@SamJWeissman Can you double check that you have followed the setup under "iOS - Add App Groups" AND "iOS Service Extensions" https://documentation.onesignal.com/docs/cordova-sdk-setup#section-ios-add-app-groups-optional-but-recommended-
Both are needed to support the badge increase option
@jkasten2
I definitely followed all of the steps from both of those sections. The badge increase is working, and being grouped properly on our apps icon.
It just doesn't reset to 0 when the app is opened... it is VISUALLY cleared ( the badge no longer shows ), but when I get a new notification, it resumes from where it left off.
@SamJWeissman this is definitely an app group issue. Can you send screenshots of the App Group capability for both your app target and Extension Service target? Also, what is your app’s bundle ID?
Hi @Nightsd01,
The apps bundle ID is com.waiport.mobile
Here are the screenshots you've requested.
App Target
Service Extension Target
Greatly appreciate both of you trying to help out here.
@SamJWeissman Can you post the bundle ID for your Notification Service Extension target?
@SamJWeissman Let's also try something else. In your Info.plist
for both the app and extension service, add the following key+string pair:
OneSignal_app_groups_key
= group.com.waiport.mobile.onesignal
Then go ahead and test and let me know if the issue still occurs?
@Nightsd01 Sorry was pretty swamped yesterday!
Attached are the screenshots with bundle identifiers.. Going to try updating the Info.plist and will let you know if any improvement.
@Nightsd01
Updated the app Info.plist as well as the OneSignalNotificationServiceExtension Info.plist with those key / value pairs. Unfortunately, the badge count is still not being reset to 0.
@Nightsd01 @jkasten2
This is still an issue for us unfortunately. I tried manually resetting the count using POSTMAN
ie: Made a PUT request to https://onesignal.com/api/v1/players/<my-player-id>
with Content-Type: application/json
, Authorization: Bearer-<my-api-key>
, and body as
{ app_id: <my-app-id>, badge_count: 0 }
While hitting this endpoint is returning {"success": true"}, the badge count on iOS remains unchanged.
Was hoping if that endpoint had worked, I'd be able to manually reset the badge counts whenever a user viewed their in app notifications. But this appears to be a dead end as well.
@SamJWeissman Sorry for the delay in getting back to you. Calling that endpoint won't do anything since badge count logic is now handled on the client.
Just to be sure, you are testing this on a real iOS device running iOS 10 or higher, right?
Can you try sending a rich push notification (with an image or something) and tell me if that works?
Hi @Nightsd01, we are facing the exact same problem as @SamJWeissman and I can confirm to you that sending rich push notification is working for us.
Trying to solve the problem, we did everything you suggest in this thread. In addition, we also tried adding the flag OneSignal_disable_badge_clearing
to "YES" in our info.plist
file (on the main target). Thus, we expected to handle the badge logic on the App side by using another cordova plugin.
However, despite the fact that it seems to be working when we test locally, after publishing to Apple it continues with the same problem.
@pablokintopp
Did you create your OneSignal app in or after June 2018? If so, it will be using client side badge logic.
If so, this means you are definitely facing an issue where the Extensions Service cannot communicate with your main app using an App Group.
Note that this logic only works in iOS 10 and later.
Can you please share a screenshot for where you typed the names of your app group? Both in the main app target and extension target.
@Nightsd01
Yes, I can confirm that the OneSignal app was created after June 2018. We also are aware that IOS 10+ is required to work.
Bellow are the screenshots you asked:
Facing the same problem. Same for Android on a real device. Same for IOS on a real device.
I'm using https://github.com/katzer/cordova-plugin-badge 0.8.8
@pablokintopp Have you found a solution ?
@clemishow I couldn't find a solution yet.
I'm using the same badge plugin as you (version 0.8.7).
Really need this feature !
@clemishow I would suggest removing the badge plugin to see if that fixes the auto increment issue.
Can you also try running our OneSignal Cordova Example project and let me know if this same issue occurs there (after you set it up with your same App ID, bundle ID, same app group on both the app and extension targets)
@Nightsd01 Ok but how to decrement the badges and clean them with OneSignal?
Same problem here, using here: cordova-plugin-badge - 0.8.7 onesignal-cordova-plugin - 2.4.1
Followed all those steps in https://documentation.onesignal.com/docs/ios-sdk-setup#section-1-add-notification-service-extension and in https://documentation.onesignal.com/docs/ios-sdk-app-groups-setup
@chagaspac are you using a badge plugin? That can interfere with our badge logic and we haven’t had time to investigate yet so in the mean time I’d suggest removing any badge plugin.
If not, please post screenshots of the app group capability for both the main app target and the extension service target.
It's just installed, but I'm not using anymore. I will uninstall it and try again.
Follow the screenshots:
Edit: I'm testing in real devices, through TestFlight and handling notifications normally. In android this problem (not resetting badge) don't happen.
I uninstalled the badge plugin from npm and Cordova plugin, redeployed at TestFlight, and didn't worked.
@chagaspac please add OneSignal_app_groups_key
= your app group name to the Info.plist
files for both the app and the extension service (they will have their own separate Info.plist files)
Having the same issue here. Badges increment fine. They "clear" on resume, but then the next notification just increases the previous count. So after reading around for solutions, I too started using the badge plugin in hopes of just being able to clear. All the badge plugin calls I have tried seem to "work" as well.
I followed the set up guide for iOS and am using the One Signal Notification Service Extension, and I have added the OneSignal_disable_badge_clearing.
example. App in background and notification raised badge count to 12. I was testing, and set the badge plugin to set the badge count to 20 on resume. Put app back into background and the badge was 20. When I sent the next notification it changed to 13. So somewhere it's still keeping the count.
using: cordova-plugin-badge - 0.8.8 onesignal-cordova-plugin - 2.4.6
@Goregut please read the comments above and troubleshooting steps. Adding a separate badge plugin will literally only make this problem worse.
You likely have a mismatch issue with your app group name. If not, try adding the app group name to your info.plist as I’ve detailed above.
@Nightsd01 Sorry, thought I'd already tried that. To confirm my badges seem to be working and staying cleared after removing all the custom stuff I added and then put the OneSignal_app_groups_key = groups.mygroupsman in the info files.
Thanks for the help.
@Goregut Can you decrement the badges one by one? Clear the badges work?
@goregut I’m a bit confused then, what exactly is the issue you are having..?
@Nightsd01 Originally I was having issues with the badges staying cleared. They would clear out on resume, but then the next notification would add to the number it was before it was cleared. Now after adding the groups in the info.plist files things seem to be working how I need them.
@clemishow I'm not sure. I haven't tried decrease them. I don't have a use case for needing to do it yet.
@Nightsd01 I've added this key with the same group name and I'm waiting for review to test with others features. (I don't have right now a physical device to test it with TestFlight).
@Nightsd01 The problem wasn't resolved with the fix
@chagaspac are you sure that you added OneSignal_disable_badge_clearing
to both Info.plist
files (for the app itself and the Extension service)?
It’s going to take a LONG time to debug this if you are actually testing each step with a full App Store release..
Same issue on Unity3D plugin
@chagaspac closing due to no response.
Please @ me and I will reopen if anyone is still having this issue.
@leszekkrol please file an issue in the Unity SDK repo
@rgomezp I still with the problem
Just to summarize, the fix that has worked for folks is adding OneSignal_app_groups_key & value in the info files. They also removed any additional badge plugins. Can you confirm you have tried these?
Closing due to no response
Hi, I'm facing exact the same problem, badge number is not reset at OneSignal. I have added OneSignal_disable_badge_clearing and OneSignal_app_groups_key to my info.plists as above had suggested, but still, badge number is not reset.
I wonder what might went wrong...
Also, I don't know if that matters but do I have to name my appGroup following this naming rule : group.{your_bundle_id}.onesignal ? because I had named my appGroup following other naming rule.
We're aware of the issue and are looking into it. As long as the name is the same in both targets, I think you should be fine. However, it doesn't hurt to follow that naming convention as I'm not the person who wrote the SDK
Please follow https://documentation.onesignal.com/docs/ios-sdk-app-groups-setup in detail.
The name of your app group should be group.{your_bundle_id}.onesignal. So for example, if your application's bundle identifier is com.test.app, your app group name should be group.com.test.app.onesignal.
Assign the group to both target.
- Open your Info.plist file and add a new OneSignal_app_groups_key as a String type.
- Enter the group name you checked in the last step as it's value.
- Make sure to do the same for the Info.plist under the OneSignalNotificationServiceExtension folder.
I have the same issue. Everything works fine when installed by Xcode while developing but the issue happens when app's installed from Testflight.
However I tried to solve the issue as above suggestions but didn't help.
I have the same issue. Everything works fine when installed by Xcode while developing but the issue happens when app's installed from Testflight.
However I tried to solve the issue as above suggestions but didn't help.
Please check app groups are same for both target - Application and extension. The app group id should be like: group.{your_bundle_id}.onesignal. You must follow the naming convention. Also you have to add OneSignal_app_groups_key in info.plist of both target and put the group name.
These are only the steps, I have solved the issue.
@Ankush-Redapple Could you check my config to find out what's wrong? Thanks for your help.
@SamJWeissman this is definitely an app group issue. Can you send screenshots of the App Group capability for both your app target and Extension Service target? Also, what is your app’s bundle ID?
Didn't know that I have to set it also to NotificationService --> Then I had this issue. Solved for me! Thank you!
Hi,
This is happening also to me randomly, sometimes works, sometimes not... I'm following the name convention and the official guide, so theoretically the .plist step is not required.
Could be this any issue with the SDK? 😰
I have the same issue. Everything works fine when installed by Xcode while developing but the issue happens when app's installed from Testflight.
However I tried to solve the issue as above suggestions but didn't help.
I think that is something random, same here: from TestFlight isn't working ❌
I have the same issue. Everything works fine when installed by Xcode while developing but the issue happens when app's installed from Testflight. However I tried to solve the issue as above suggestions but didn't help.
I think that is something random, same here: from TestFlight isn't working ❌
Same here, I don't why sometimes it works or not, the guide is pretty clear I think, and I'm doing the steps as always... From Xcode works, but from Testflight it doesn't
Hi again ✋ ,
Reviewing the Release Notes, I saw that in version v2.4.2
this was fixed:
Fixes an issue that would occasionally cause the SDK to be unable to automatically retrieve the App Group name, which was used to enable communication between the Service Extension and the main app. The main side effect of this issue would have been inconsistent badge logic, where the SDK would not maintain a logically consistent badge count.
Which is exactly what happens to me, could be maybe some regression? I have v2.4.6
right now ...
we are seeing the same issue, works fine when building directly to a device on xcode, once we push to test flight it doesn't clear. we are on v2.4.7 and both .plist do include OneSignal_app_groups_key tag.
Hey guys, I have already solved this issue. mention to https://github.com/j3k0/cordova-plugin-openwith/issues/48
This is an issue with your entitlements files. Inside your platform folder you can find two files for the Entitlements, one for debug and one for production builds(release). For some reason the plist file for your production builds ( which I assume is necessary for uploading your app to TestFlight) is not updated with the Capapilities you select in XCode. Have a look at the content of the Entitlements-Release.plist file and change it so it has to be the same content as your Entitlements-debug.plist file.
You can find entitlements file location from xCode >> Your Targets >> Build Settings >> then search Entitlements.
For example.
my original Entitlements-Release.plist contains
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
</dict>
</plist>
So I have to change it to the same as Entitlements-debug.plist......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.{your_bundle_id}.onesignal</string> <!--Fill your bundle id-->
</array>
</dict>
</plist>
will solved this issue.
Description:
Push notifications and incrementing of the badge count all work perfectly. Unfortunately, while the badge is "cleared", when a new notification comes through, it resumes with the previous badge count rather than starting from 0.
Environment
cordova plugin list
or copy-pasting your config.xml)cordova-plugin-hockeyapp 5.1.2 onesignal-cordova-plugin 2.4.5 ccordova-plugin-splashscreen 5.0.2 cordova-plugin-device 2.0.2 cordova-plugin-whitelist 1.3.3 cordova plugin-wkwebview-engine 1.1.4 corova-plugin-wkwebview-file-xhr 2.1.1 cordova-plugin-inappbrowser 3.0.0 cordova-plugin-web-share 1.1.0 cordova-plugin-network-information 2.0.1
ios engine 4.5.5
Steps to Reproduce Issue:
Note: Not sure if this is relevant. The .ipa is currently being downloaded from HockeyApp. We've pushed/downloaded several versions throughout the development phase ( we're still waiting for review from Apple ). I'm not sure if that would make any difference in the issue we're seeing.Can confirm that this issue is seen when downloading from the App Store as well