Closed lo-re-co closed 3 years ago
Thanks for the feedback, Ill add this request to our work queue
Thanks for the feedback, Ill add this request to our work queue
Thank you, also the flutter SDK doesn't provide a method to reset the badge counter. Working on native swift code it is possible to hide it when the user open the app, but on a new notification message the counter will just increment by 1. (the backend payload is configured to do so).
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func applicationWillEnterForeground(_ application: UIApplication) {
application.applicationIconBadgeNumber = 0;
}
override func applicationDidBecomeActive(_ application: UIApplication) {
application.applicationIconBadgeNumber = 0;d
}
}
You send absolute values through the payload, not increment. In order to use the increment feature, we have to sync the count from the device to our backend. If you are in native code, you could add a call to UAirship.push().isAutobadgeEnabled = true
You send absolute values through the payload, not increment. In order to use the increment feature, we have to sync the count from the device to our backend. If you are in native code, you could add a call to
UAirship.push().isAutobadgeEnabled = true
While this has become clear over numerous trials and errors, a very important feature I'd wish this library had is the possibility to:
set auto badge enabled from the flutter library's dart code (initializing Airship through native code when you have already done so by using this lib is not ideal and a bit of a pain);
ability to have the Airship.resetBadge() method in Flutter too. I feel like this is a very important feature missing for the Flutter Library.
Thanks for the reply!
The work on our queue is to add the following methods:
You probably will be able to get to the work before we do, so if you wan't to add to the plugin I can help you. The react-native module has these methods already so you could take a look at how that is done.
While I've already solved this server side I truly appreciate the reactivity and the work you put on your side. Also, nice cat!
P.s. you can mark this thread as closed if you wish so
❗For how-to inquiries involving Airship functionality or use cases, please contact (support)[https://support.airship.com/].
Preliminary Info
What Airship dependencies are you using?
airship_flutter: ^4.3.0
What are the versions of any relevant development tools you are using?
Flutter (Channel stable, 2.2.3), Android Studio (version 4.2)
Report
What unexpected behavior are you seeing?
While push notifications do work, on iOS devices badge won't appear on the app icon when receiving notifications. Sadly the documentation provide only native methods to enable badging/auto-badging and it seems like there are no flutter methods to do so.
What is the expected behavior?
Implementing badging/auto-badging in Flutter code
What are the steps to reproduce the unexpected behavior?
Setup a push receiving app on iOS and send push notifications via a PHP Api
Do you have logging for the issue?