How can I show a toast notification every 15 seconds while the application is in background? DispatcherTimer doesn't work because my app is suspended and background tasks can't run at this frequency.
You can use a Background Task to do toast notifications, but the minimum interval is 15 minutes.
Michael
Related
Ive cycled through a number of libraries trying to implement a timer that runs in background for React Native (ios).....after an hour I want user notified that hour has passed (even if app is in background).
Ive tried:
react-native-background-timer: flat out doesnt work for ios.....app closes down after less than a minute
react-native-background-fetch: app does stay in background.....however there is no control over how often background event fires. I only want my timer to run for an hour....so if the background event takes a whole day to fire then its useless.
Short question is I want to find a react native library that allows me to run a timer in background from 1 hour to zero....then notifies user that hour has passed (Im using react-native-push-notification for notifications.....and thats working fine).
Any ideas?
So, I'm developing an app that has a timer for about 5 minutes. During this time, the app should remain active. Accessing geolocation, counting steps, etc. The problem I'm facing is that the app falls asleep and the timer stops ticking.
I'm using react-native-background-timer for a timer. It shouldn't fall asleep, but it does. On both, android and ios. Actually it works perfectly fine when the app is in debug mode. But on release version without debug app simply falls asleep after about 3 minutes when the screen is turned off and timer stops ticking. It resumes when phone wakes up.
I can keep screen on all the time, with react-native-keep-awake, but I don't like this solution. Because my app also counts steps, and the phone should be ideally in the pocket. And with active screen, it will register accidental presses. Not good.
There should be a way. Phone calls can be really long with disabled screen and phone app doesn't sleep. I just don't know which direction to take. It's also hard to test, because with debug mode, app doesn't fall asleep at all. I need to run the release version and wait 3 minutes hoping the timer won't asleep.
Any ideas? Thanks.
My CRNA (Expo) app schedules local notifications for event reminders. The notifications are scheduled and received perfectly on Android, but not iOS.
I've created a reduced test case: https://github.com/nandastone/crna-expo-local-notification-test
Tapping the "Send Immediate Notification" button calls Notifications.presentLocalNotificationAsync() which IS then received by the callback.
Tapping the "Send Delayed Notification" button schedules a notification in 5 seconds with Notifications.scheduleLocalNotificationAsync() which IS NOT received by the callback.
I'm aware that notifications are not displayed by iOS if the app is in the foreground (https://forums.expo.io/t/psa-reminder-notifications-in-ios-foregrounded-apps/641), but I'm not receiving notifications at all in the Notifications.addListener() callback. Closing the app after scheduling a notification also has no effect.
I'm fairly certain the Permissions.REMOTE_NOTIFICATIONS check is not required for local notifications (it certainly isn't on Android), but I've included it to be sure.
Please help!
In my reduced test case I was missing an event listener for receiving notifications (Notification.addListener()).
The issue in my real app, however, was the limit of 64 local notifications on iOS. The app was scheduling more than 64 notifications at once, and they were not all firing.
I have a timer made in Titanium (3.1.3) for iOS 7. I want it to fire a notification when the timer is finished. It works perfectly until the app is placed in the background for more than 20 minutes. If the app is placed in the background for more than 20 minutes, the user don't get any notification.
This is my code:
var notification = Ti.App.iOS.scheduleLocalNotification({
alertBody:L('timer_finished_alert_title'),
badge:1,
sound: notificationSound,
date:new Date(new Date().getTime() + timeLeft)
});
How can I fire this notification if the user has left the app in the background for more than 20 minutes (timeLeft > 1200000)?
That is a limitation of iOS Background Service in Titanium.
From the documentation
Background Service Limitations
A background service is subject to limitations imposed by the operating system, such as
The OS limits the total amount of time a background service can run for after the application is paused, typically to no more than 10
minutes.
The OS may terminate the background service at any point to reclaim resources.
I've a app called 'drumtime' installed on Windows 8. It's tile is being changed/updated on every about 10 seconds. This couldn't be done with Background tasks I guess because a background task needs 15 minutes to be executed. But even if the app is not running, it's tile is still being updated.
after 10 seconds =>
So, how can I update an app's tile on every 10 seconds even when the app itself is not running?
I appreciate any help.
I downloaded Drumtime to check this out, and it is using a peek animation on its live tile. Check out the list of available tile templates. Some of these are "peek" templates which animate smoothly between two different tile templates. That is what Drumtime is doing. I used a peek animation in the tile of an app of mine; I wrote this article with details.
Here is MSDN sample of updating tile in every minute. You can learn the logic. You have to set schedule in such manner the tile gets update in 10 seconds.