Keep specific notification on the top of the notifications center - iphone

I want to simulate a lightweight iPhone "widget" by having a specific notification in the notifications center that opens the app and performs a quick action (i.e. "Add new task").
The problem is that when I get new notifications (push or local notifications), the widget task is pushed down, and the most recent notification becomes the first one.
I tried solving this by adding a repeat interval for the "widget" notification, but the problem is that it duplicates this notification, and since I'm in the background I can't cancel the previous ones.
Any ideas?

Related

Flutter navigator.push, set it to only push once, disallow user to press multiple times to push multiple pages

My app receives in-app notifications from Firebase. When the notification is pressed, it will prompt the user to the page.
My issue is if the notification is pressed multiple times, it will push the same page multiple times, causing to have lots of the pages in the stack. Is it possible to configure and limit Navigator.push to push only once?
I have tried using pushReplacemement but I'm still facing the same issue.
PushReplacement will not work since it always create new instances of widget every time.
I can see 2 ways to fix it:
Manage while pushing: You can try to store a variable (or as persistent data) that stores if the page has been pushed or not and only push if it is the first time.
Manage while poping: If the number of pages doesn't matter and all you care about is going back to the main screen on pressing back, use the popUntil method to pop until to return to the desired page.
Although I do not know the context of your application, getting same notification multiple time is probably not a good idea. You should probably change the functionality there instead. (Just a suggestion and do your own research).

Flutter app icon notification badge no longer working

The app icon's red badge number no longer seems to update on the app icon whenever I get a push notification and I'm not sure why.
Recently, I dealt with the problem of the app icon red badge not going away after push notifications are received, so I implemented the flutter_app_badger package in order to get rid of the app icon badge number after going to a specific part of the app.
But however this introduced a new problem of the app icon badge no longer appearing at all now whenever I receive push notifications.
So instead I tried another package called flutter_dynamic_icon, which has the ability to alter the badge number on the app icon as well and unfortunately the problem of the app icon badge not appearing still persists.
The idea is whenever the user goes to a certain new part of the app that the notification refers to, (or if the notification is clicked on) it gets rid of the notification badge icon on the app icon (or at least decrements it by 1).
So basically, the app icon badge could be altered when I implemented the package but now the app icon badge number no longer appears whenever I receive a push notification.
Can anyone help me understand why this may stop working all of a sudden after adding the flutter_dynamic_icon or flutter_app_badger package?
What would cause the app icon badge to no longer appear after receiving a push notification?
Some info if it helps, I'm currently using:
flutter_dynamic_icon (I was using flutter_app_badger, then when the app icon badge no longer appeared I switched to flutter_dynamic _icon)
Firebase cloud messaging for push notifications (though it was working before I tried using flutter_app_badger, then switched the flutter_dynamic_icon.
Thank you very much.

Is it possible to avoid showing app to user when tapping on a push notification in iOS?

I want the application not be shown when tapping on the notification.
I want to do some background task or just simply open a URL but not the application.
For instance, I found that I can simply add web view in my application or open the browser to open the url, but how can I prevent showing the application(not bring it to foreground)?
I also don't want to do the background task with silent push notification as I want to show this notification to the user.

Customizing UILocalNotification Alert - with swipe slider or buttons

I know this has been asked before. However...
While until recently I thought that the only possible and accepted Alert is the text with 2 buttons I found some apps which have a different local alert.
So I assume there is an accepted way to customize the lokal Alert. Is this correct or have these apps just "slipped" into the store somehow - as I know this happened before with feature and then the app disappeared from the store suddenly.
I could not find anything about it.
Many thanks
As of iOS 5:
When a UILocalNotification is delivered while the device is locked, it appears on the lockscreen with a swipe slider to open the app.
If the notification is delivered while the device is in use, it can appear either as a banner across the top of the screen, or as an alert with two buttons.
One button is always a cancel button.
The other button opens the application. You can change the text of this button by setting the alertAction property.
You can disable this action button on the alert by setting hasAction = NO on the notification).
There are no other available ways a notification alert can arrive, unless of course the device is jailbroken. In that case, many things are possible.
Before iOS 5, only popup alert notifications were supported.
Due to the nature of iOS, it is technically not possible to deliver a notification in any other way, or customise the alert, as the notification delivery is handled by the system and the app has no access to the system UI, and so cannot display any messages by itself. And even if you did somehow manage that, Apple wouldn't allow it.
Read the UILocalNotification docs here: http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Reference/UILocalNotification_Class/Reference/Reference.html for more detailed information.

UILocalNotification in sleep mode on iPhone

I'm developing a Voip application.
When I press the lock button(app goes to sleep), and the server sends a request I present a local notification.
The local notification is presented as it should and The button slider text says "slide to answer". If I slide here, the app gets open.
However, if now I press again the lock button, and then unlock, the notification is still presented and the slider text has changed to "slide to unlock".
Now, when I slide to unlock, it's as if I pressed the "close" button on a regular notification bar, meaning the app won't open.
My question is why on the second time the local notification is still presented ? and if so, is there a way to track the unlock button event or the unlock slider so I can tell the server that I don't want to answer the call ?
Thanks
The notification is only a dialog (i.e., the user can interact with it directly) for a short time - until the device is locked again, either by using the button or automatically after a time-out of about 15 seconds.
After that, it turns into a notification. The user cannot interact with it directly, apart from reading the message.
Sorry, but it doesn't get any better unfortunately.