Android Service not active alwaysHow do save an Android Activity state using save instance state?Activity restart on rotation AndroidHow to check if a service is running on Android?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?Stop EditText from gaining focus at Activity startupIs there a unique Android device ID?Example: Communication between Activity and Service using MessagingProper use cases for Android UserManager.isUserAGoat()?Service vs IntentService
How would I stat a creature to be immune to everything but the Magic Missile spell? (just for fun)
Can compressed videos be decoded back to their uncompresed original format?
How could indestructible materials be used in power generation?
Is it possible to create a QR code using text?
Is there an expression that means doing something right before you will need it rather than doing it in case you might need it?
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
CAST throwing error when run in stored procedure but not when run as raw query
What are some good books on Machine Learning and AI like Krugman, Wells and Graddy's "Essentials of Economics"
Avoiding the "not like other girls" trope?
Why didn't Boeing produce its own regional jet?
Am I breaking OOP practice with this architecture?
Why would the Red Woman birth a shadow if she worshipped the Lord of the Light?
How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?
Alternative to sending password over mail?
Method Does Not Exist error message
Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?
Forgetting the musical notes while performing in concert
Why can't we play rap on piano?
Determining Impedance With An Antenna Analyzer
Would Slavery Reparations be considered Bills of Attainder and hence Illegal?
Examples of smooth manifolds admitting inbetween one and a continuum of complex structures
Is this a hacking script in function.php?
ssTTsSTtRrriinInnnnNNNIiinngg
Ambiguity in the definition of entropy
Android Service not active always
How do save an Android Activity state using save instance state?Activity restart on rotation AndroidHow to check if a service is running on Android?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?Stop EditText from gaining focus at Activity startupIs there a unique Android device ID?Example: Communication between Activity and Service using MessagingProper use cases for Android UserManager.isUserAGoat()?Service vs IntentService
I use alarm service to start the service forever but this is not a solution and sometime stopped to work too ... so What is the best way to run a service always like WhatsApp?
add a comment |
I use alarm service to start the service forever but this is not a solution and sometime stopped to work too ... so What is the best way to run a service always like WhatsApp?
add a comment |
I use alarm service to start the service forever but this is not a solution and sometime stopped to work too ... so What is the best way to run a service always like WhatsApp?
I use alarm service to start the service forever but this is not a solution and sometime stopped to work too ... so What is the best way to run a service always like WhatsApp?
edited Mar 8 at 6:29
Marcin Orlowski
58.5k892121
58.5k892121
asked Mar 7 at 22:17
Ali MorselAli Morsel
62
62
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
After android oreo google restricted to run service for long time. You need to go with firebase or any persistent notification by using following code
context.startForegroundService(intent); -> you need to put startForeground() code in the onCreate method of the service.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053693%2fandroid-service-not-active-always%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After android oreo google restricted to run service for long time. You need to go with firebase or any persistent notification by using following code
context.startForegroundService(intent); -> you need to put startForeground() code in the onCreate method of the service.
add a comment |
After android oreo google restricted to run service for long time. You need to go with firebase or any persistent notification by using following code
context.startForegroundService(intent); -> you need to put startForeground() code in the onCreate method of the service.
add a comment |
After android oreo google restricted to run service for long time. You need to go with firebase or any persistent notification by using following code
context.startForegroundService(intent); -> you need to put startForeground() code in the onCreate method of the service.
After android oreo google restricted to run service for long time. You need to go with firebase or any persistent notification by using following code
context.startForegroundService(intent); -> you need to put startForeground() code in the onCreate method of the service.
answered Mar 8 at 6:28
MagudeshMagudesh
13318
13318
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053693%2fandroid-service-not-active-always%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown