react-native-background-timer
react-native-background-timer copied to clipboard
Background timer stopped after 30 seconds on iOS 13.3 & 13.3.1
In iOS 13.3 & 13.3.1, when the count down timer is running in the background, it will be paused after 30s.
- Start a 60s count down timer in the foreground.
- After 10s, Put the app in the background (at 50s).
- Wait for 40s, while the app is in the background.
- Come to the foreground back.
- The count down timer starts to run from 20s but expected to be run from 10s.
Guys... Do you have any idea?
@iamtharin I have fixed this with the following solution.
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
Add this in Info.Plist of your project and it will work
@Zilleabbas10 We have already added it but the issue is there :(
it doesn't work on iOS 12.1.4
my code:
import React, { Component } from 'react';
import {
SafeAreaView,
Text,
StatusBar,
TouchableHighlight,
Alert,
} from 'react-native';
import BackgroundTask from 'react-native-background-task'
import queueFactory from 'react-native-queue';
import { Notifications } from "react-native-notifications";
import BackgroundTimer from 'react-native-background-timer';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
isOpened: false,
queue: null
}
Notifications.registerRemoteNotifications();
Notifications.events().registerNotificationReceivedForeground((notification: Notification, completion: (response: NotificationCompletion) => void) => {
Alert.alert('Bildirimler gelecek', '', [{ text: 'Kapat' }]);
console.warn("Notification Received - Foreground", notification.payload);
// Calling completion on iOS with `alert: true` will present the native iOS inApp notification.
completion({alert: true, sound: true, badge: true});
});
Notifications.events().registerNotificationOpened((notification: Notification, completion: () => void, action: NotificationActionResponse) => {
Alert.alert('bildirim açıldı!');
console.warn("Notification opened by device user", notification.payload);
completion();
});
Notifications.events().registerNotificationReceivedBackground((notification: Notification, completion: (response: NotificationCompletion) => void) => {
console.log("Notification Received - Background", notification.payload);
// Calling completion on iOS with `alert: true` will present the native iOS inApp notification.
completion({alert: true, sound: true, badge: false});
});
}
componentDidMount() {
BackgroundTimer.start();
setInterval(() => {
return Notifications.postLocalNotification({
body: "Tahmini 15 dk sonra gelen bildirim: 10:15",
title: "Local Notification Title",
sound: "chime.aiff",
silent: false,
category: "SOME_CATEGORY",
userInfo: { }
}, 3);
}, 1000 * 10);
BackgroundTimer.stop();
}
render() {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView style={{ flex: 1, alignItems: 'center', justifyContent: 'center', }}>
<Text>Deneme</Text>
</SafeAreaView>
</>
)
}
}
@gunduzcihat @iamtharin did you guys find any solution for iOS?
We had to do a work around. What we did was, playing a silent audio while the app is in the background mode. This worked as expected.
On Wed, May 6, 2020, 6:49 PM tal987 [email protected] wrote:
@gunduzcihat https://github.com/gunduzcihat @iamtharin https://github.com/iamtharin did you guys find any solution for iOS?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-624644084, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOSY6LWO7RL4WCJPG57ZR3LRQFPVLANCNFSM4KY7N35A .
@iamtharin can you show how did you do that please? how did you play silent sound?
@iamtharin
this is what you did?
BackgroundTimer.runBackgroundTimer(() => { var fakeSound = new Sound('', Sound.MAIN_BUNDLE, (error) => { if (error) { console.log('failed to load the sound'); } }) fakeSound.play((success) => { if (success) { } else { } }); console.log("App is Hii") }, 3000*10);
Any news on this issue?
Also reproduced on iOS 12.4.8
Nothing yet?
@iamtharin I have fixed this with the following solution.
<key>UIBackgroundModes</key> <array> <string>audio</string> </array>
Add this in Info.Plist of your project and it will work
This worked for me, very strange, because i set
+1, stop after 30 seconds
@iamtharin I have fixed this with the following solution.
<key>UIBackgroundModes</key> <array> <string>audio</string> </array>
Add this in Info.Plist of your project and it will work
This worked for me, very strange, because i set location before but didn't work
I've tried this and got this message back from Apple.
Your app declares support for audio in the UIBackgroundModes key in your Info.plist, but we were unable to play any audible content when the app was running in the background.
We had to do a work around. What we did was, playing a silent audio while the app is in the background mode. This worked as expected. … On Wed, May 6, 2020, 6:49 PM tal987 @.***> wrote: @gunduzcihat https://github.com/gunduzcihat @iamtharin https://github.com/iamtharin did you guys find any solution for iOS? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#191 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOSY6LWO7RL4WCJPG57ZR3LRQFPVLANCNFSM4KY7N35A .
helo , how did you apply silent audio in bg. pls help me i am stuck in this issue last two week, can you give your contact or pls call on 8423087803, i need your helo
When the user is going to the background, a silent audio will be played until the user comes back from the background to the foreground. That's all what we did.
On Thu, Aug 12, 2021, 11:57 AM Amar-RN @.***> wrote:
We had to do a work around. What we did was, playing a silent audio while the app is in the background mode. This worked as expected. … <#m_1910379230135917114_> On Wed, May 6, 2020, 6:49 PM tal987 @.***> wrote: @gunduzcihat https://github.com/gunduzcihat https://github.com/gunduzcihat @iamtharin https://github.com/iamtharin https://github.com/iamtharin did you guys find any solution for iOS? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#191 (comment) https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-624644084>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOSY6LWO7RL4WCJPG57ZR3LRQFPVLANCNFSM4KY7N35A .
helo , how did you apply silent audio in bg. pls help me i am stuck in this issue last two week, can you give your contact or pls call on 8423087803, i need your helo
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-897382922, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOSY6LQRONGQ2KVUKISUI6TT4NSW3ANCNFSM4KY7N35A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
can u share your contact no ? please please
if you dont mind.
On Thu, 12 Aug 2021 at 12:14, iamtharin @.***> wrote:
When the user is going to the background, a silent audio will be played until the user comes back from the background to the foreground. That's all what we did.
On Thu, Aug 12, 2021, 11:57 AM Amar-RN @.***> wrote:
We had to do a work around. What we did was, playing a silent audio while the app is in the background mode. This worked as expected. … <#m_1910379230135917114_> On Wed, May 6, 2020, 6:49 PM tal987 @.***> wrote: @gunduzcihat https://github.com/gunduzcihat https://github.com/gunduzcihat @iamtharin https://github.com/iamtharin https://github.com/iamtharin did you guys find any solution for iOS? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#191 (comment) < https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-624644084
, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AOSY6LWO7RL4WCJPG57ZR3LRQFPVLANCNFSM4KY7N35A
.
helo , how did you apply silent audio in bg. pls help me i am stuck in this issue last two week, can you give your contact or pls call on 8423087803, i need your helo
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-897382922 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AOSY6LQRONGQ2KVUKISUI6TT4NSW3ANCNFSM4KY7N35A
. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android < https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-897389943, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATU7BUGXA66KWTS67LUG7OTT4NUUFANCNFSM4KY7N35A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
Please call on 8423087803 or what app i need your help.
On Thu, 12 Aug 2021 at 12:55, Amar Gupta @.***> wrote:
can u share your contact no ? please please
if you dont mind.
On Thu, 12 Aug 2021 at 12:14, iamtharin @.***> wrote:
When the user is going to the background, a silent audio will be played until the user comes back from the background to the foreground. That's all what we did.
On Thu, Aug 12, 2021, 11:57 AM Amar-RN @.***> wrote:
We had to do a work around. What we did was, playing a silent audio while the app is in the background mode. This worked as expected. … <#m_1910379230135917114_> On Wed, May 6, 2020, 6:49 PM tal987 @.***> wrote: @gunduzcihat https://github.com/gunduzcihat https://github.com/gunduzcihat @iamtharin https://github.com/iamtharin https://github.com/iamtharin did you guys find any solution for iOS? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#191 (comment) < https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-624644084
, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AOSY6LWO7RL4WCJPG57ZR3LRQFPVLANCNFSM4KY7N35A
.
helo , how did you apply silent audio in bg. pls help me i am stuck in this issue last two week, can you give your contact or pls call on 8423087803, i need your helo
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-897382922 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AOSY6LQRONGQ2KVUKISUI6TT4NSW3ANCNFSM4KY7N35A
. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android < https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-897389943, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATU7BUGXA66KWTS67LUG7OTT4NUUFANCNFSM4KY7N35A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
hey,
How did you do , can u please share code.
On Thu, 12 Aug 2021 at 12:14, iamtharin @.***> wrote:
When the user is going to the background, a silent audio will be played until the user comes back from the background to the foreground. That's all what we did.
On Thu, Aug 12, 2021, 11:57 AM Amar-RN @.***> wrote:
We had to do a work around. What we did was, playing a silent audio while the app is in the background mode. This worked as expected. … <#m_1910379230135917114_> On Wed, May 6, 2020, 6:49 PM tal987 @.***> wrote: @gunduzcihat https://github.com/gunduzcihat https://github.com/gunduzcihat @iamtharin https://github.com/iamtharin https://github.com/iamtharin did you guys find any solution for iOS? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#191 (comment) < https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-624644084
, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AOSY6LWO7RL4WCJPG57ZR3LRQFPVLANCNFSM4KY7N35A
.
helo , how did you apply silent audio in bg. pls help me i am stuck in this issue last two week, can you give your contact or pls call on 8423087803, i need your helo
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-897382922 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AOSY6LQRONGQ2KVUKISUI6TT4NSW3ANCNFSM4KY7N35A
. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android < https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ocetnik/react-native-background-timer/issues/191#issuecomment-897389943, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATU7BUGXA66KWTS67LUG7OTT4NUUFANCNFSM4KY7N35A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
any update ?
hey, i have the same error, stop working after 30sec