-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Foreground Service works on Foreground but not on Background #632
Comments
please stop mentioning everybody 😅I don't have a role here |
Sorry @meypod. I'm new in this stuff and don't know exactly how it works yet. Hope you have a wonderful new year |
I closed this issue by accident, but I will appreciate a lot if somebody helps me :) |
have you searched the issues for anything similar? What happens when the app is in the background? you say it doesn't work, can you describe in more detail? |
Hi ,
the application shows the notification but the code doesn't run no logs nothing runs till it is back to foreground |
I found out that the foreground service runs find and the issue is with setinterval I have used this package |
@medonagy45 thanks for sharing your solution. Will close as it seems that issue is outside of notifee. |
i have faced this issue ona android 14
i fixed it with adding the following in the AndroidManifest.xml
|
this is an issue with the permission on android 14 . and i have share the solution for this |
Issue: Foreground Service Works in Foreground but Not in Background on Android |
@muhammadasifdotai your comment does not have enough information to be actionable and is posted on an issue that has been closed for more than a year, meaning there will be no support on this issue web search: stackoverflow how to ask |
Please somebody save me!!
I'm trying to run a background service to get the user's location.
I tried to follow the notifee's documentation and the service works in foreground, but it doesn't when the app is in background
Note: I'm using function and hooks
**notifee.registerForegroundService((notification) => {
console.log("notification ", notification);
return new Promise(() => {
// Long running task...
myLoop();
function myLoop() {
var i =0;
setTimeout(function() {
console.log('hello ', i);
i++;
if (i < 10) {
myLoop();
Geolocation.getCurrentPosition(
(position) => {
console.log("position ",position);
},
(error) => {
// See error code charts below.
console.log(error.code, error.message);
},
{ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000 }
);
}
}, 2000)
}
});
});
async function onDisplayNotification() {
Note: I already added the line below in Android.Manifest but it still doens't work
@helenaford @mikehardy @liamjones @meypod
The text was updated successfully, but these errors were encountered: