Giter Club home page Giter Club logo

Comments (6)

jkasten2 avatar jkasten2 commented on May 18, 2024 5

To increment the badge count when a notification is received you can set ios_badgeType to "Increase" and ios_badgeCount to 1. Our SDK should be resetting the badge count back to 0 each time the app is opened / resumed automatically. I haven't seen any bugs with this is it is more likely another plugin / SDK code be interfering. Can you try to reproduce the issue in a new project? Let us know the steps to reproduce the issue if you're still seeing it.

You can set content_available to true on OneSignal to wake up your app in the background. It will fire the application:didReceiveRemoteNotification:fetchCompletionHandler: selector in your app's code.

Thanks.

from onesignal-ios-sdk.

holgersindbaek avatar holgersindbaek commented on May 18, 2024

That's not what I'm experiencing. When I enter the app, the increment count is not reset. It might be that it's reset if you open the app by clicking the notification, but not if you open the app like normal.ย 

All the best

Holger Sindbaek ยท UI/UX Designer & Web/iOS Programmer ยท HolgerSindbaek.com

On Fri, Feb 12, 2016 at 2:07 PM -0800, "Josh Kasten" [email protected] wrote:

To increment the badge count when a notification is received you can set ios_badgeType to "Increase" and ios_badgeCount to 1. Our SDK should be resetting the badge count back to 0 each time the app is opened / resumed automatically. I haven't seen any bugs with this is it is more likely another plugin / SDK code be interfering. Can you try to reproduce the issue in a new project? Let us know the steps to reproduce the issue if you're still seeing it.

You can set content_available to true on OneSignal to wake up your app in the background. It will fire the application:didReceiveRemoteNotification:fetchCompletionHandler: selector in your app's code.

Thanks.

โ€”
Reply to this email directly or view it on GitHub.

from onesignal-ios-sdk.

jkasten2 avatar jkasten2 commented on May 18, 2024

The only issue I can see where the badge counter would not be cleared is if you were not calling initWithLaunchOptions from the application:didFinishLaunchingWithOptions: selector in your app or there is another plugin / SDK or code changing the value.

We have a clearBadgeCount internal function that is called in a number of locations to make sure the badge is cleared. It includes the follow events.

  • An app cold start from either tapping on a notification or tapping on the app icon. Called from it application:didFinishLaunchingWithOptions: as long as initWithLaunchOptions is called from it.
  • When focus is resumed to the app from any event. Our SDK hooks into applicationWillResignActive: where this function is called.
  • A OneSignal notification event is fired. Anytime a OneSignal notification is counted as open from either tapping on one or one is received while the app is in focus.

Can you post a project reproducing the issue along with the iOS version you're testing on with step by step instructions reproducing the issue?

Thanks.

from onesignal-ios-sdk.

holgersindbaek avatar holgersindbaek commented on May 18, 2024

I was setting "applicationIconBadgeNumber" manually different places. I think that had some unexpected consequences.

I've taken that away now and it's working perfectly.

from onesignal-ios-sdk.

AmirDaliri avatar AmirDaliri commented on May 18, 2024

@jkasten2 , @ALL hi ,
how to set content_available in application:didReceiveRemoteNotification:fetchCompletionHandler ??? , What code is it? i don't know! i search about and, There is no explanation for this
please help me, Thanx

from onesignal-ios-sdk.

jkasten2 avatar jkasten2 commented on May 18, 2024

@AmirDaliri application:didReceiveRemoteNotification:fetchCompletionHandler will fire when a notification is received with content_available set to true from OneSignal. See Apple's docs below for more detail on this method.
https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application

There is another issue open related to syncing badge counts you can follow bellow.
#57

from onesignal-ios-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.