I was looking online for the best solution but couldn't find exactly what I wanted.
So, I am developing an app using React Native, and trying to make it so that even when the app is closed, once an hour a background task (which will do some fetching) will run, and at the end of it a notification (not a push notification) with a custom message will show up.
How can I achieve that?
Thank you upfront.
For Android you can use Headless JS which ships with RN. For iOS you'll need a package like react-native-background-task, which works with both. Android only projects you're probably better off just sticking with Headless.
You'll need react-native-background-task to perform the task you wish like fetching every hour, and then using some notifications library(i prefer firebase), you can show the notification to the user screen.
Also in firebase there is scheduling-notifications with which you can schedule notification showing on the screen (maybe you find a use case needing it).
Related
all day I already despair of a waking up system for my VoIP app. I must have already read over 100 articles and documentation about it, however I have not found a solution that works for me.
Use case:
My app is running in the background. That means the home button was pressed
after my app was started and the device is in the home screen. As soon as a notification arrives, the app is supposed to open again on a certain route because a call is coming in.
In the lock screen I managed this pretty easily with flutter_local_notifications and within the app it was of course no problem either.
Note:
Only Android is important, the rest can be neglected
Android version 10+
Flutter version 2+
I appreciate any input on how to solve my problem and have a good week.
Kind regards,
Shiro
I have an app that needs to show a full screen notification even when the phone is locked or the app is closed, something like ubber, when the user orders a driver i want the driver to be able to see a fullscreen notification that shows the details of the order and some action buttons that might reject the order, accept it, or open some activity in the app like checking the users profile or something.
I don't want it to be just a normal notification because the whole buisness kinda depends on it, the driver needs to be instantly informed about the order and react to it, that can be best achived with implementing a full screen notification just like answering a call, it's a time-sensitive message.
Is this possible with react native and some push notification service like OneSignal?
After doing some research i found that this may be achievable with Android using services and full screen notification intent, but in ios it's more complicated since background tasks are very restricted in iOS.
So im just looking for some insight on how to achieve this or at least something similar, is it even possible to achieve something like this? Do i have to write some platform specific code for both iOS and Android?
ANY help at all is very much appreciated, thank you.
Generally, after opening a/the clock app on a phone (at least on an Android), and starting a stopwatch (or timer), when you minimize the app, or even close it, there's usually going to be a persistent notification with the current stopwatch/timer value that continuously updates.
Here's an example GIF demonstrating this
As you can see, in the GIF, (linked above), even if I close the app, the notification displaying the current stopwatch value remains. I can't seem to find any info or examples on how I would do something like this with Ionic, or even if it's possible.
Both the Capacitor LocalNotifications plugin or the Cordova one have the option to schedule repeating notifications, but it doesn't seem like I can change the text value of the notification on each repetition.
I've also looked into the BackgroundMode plugin, thinking that maybe I could just keep sending new notifications each second from the background, but that only seems to allow me to run background tasks while the app is minimized, not when it's closed also.
So, is it even possible to display persistent updating notifications with Ionic, and if so, how?
I am working on a control-based (V2.0) SW2 app. Is it possible to set the badge-number (i.e. the notification counter) on the icon in the application view used in a notification-based app? I do not need anything else from the notification API, I just want to be able to set the badge-number and removing it after the user opens the control-based app.
Thank you,
Andrej
Unfortunately that is not currently possible without using both the Control and Notification APIs together. If you use both of them in your extension you may be able to achieve something similar to what you want but with the limitation that the extension will always start in Notification mode (this is a bug in the current implementation) so you wouldn't be able to go straight into the Control part of your extension.
I'm writing an android app just to get familiar with the OS and API. I'd like to show what my app is doing to the user in a seperate screen and not via notifications. The reason is that I'd like to show the user exactly what the app is querying and how long it took etc. I saw an example of this in the superuser app which shows what the app is doing when it is updating itself.
Is there a library to do this?
Is it as simple as just showing a text box and then populating it programatically?
I would have done it so..
Just push state changes to your UI thread and display them there.
You can do that via BroadcastReceiver, which is intended to let background services communicate with UI activities, or LocalBroadcastManager which is simpler version of the previous.
Here on StackOverflow you will find dozens of questions describing how to implement it.