This week's book giveaway is in the Spring forum.
We're giving away four copies of Java Persistence with Spring Data and Hibernate and have Cătălin Tudose on-line!
See this thread for details.
Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

immortal android service?

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it possible to make an independent service that keeps running even the app is forcibly killed by the user?
 
Ranch Hand
Posts: 600
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Omar Muhammed wrote:is it possible to make an independent service that keeps running even the app is forcibly killed by the user?


you can use an intent filter if you need it for the same app, otherwise look at PendingIntent
 
Omar Muhammed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would you give me an example please?
 
Giovanni Montano
Ranch Hand
Posts: 600
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Omar Muhammed wrote:Would you give me an example please?


you have to distinguish between the lifecycle of an Activity and the lifespan of a Service.
Do you know what is an Android Service?
Give me please an user case. Usually you do not kill the "app" but the activity.
 
Omar Muhammed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's say I have a simple service -launched by MainActivity- which is displaying a toast every x second. I know that my service will be killed if the user decided to kill MainActivity - which started it. What is to do if i want this service to keep running as long as the app is installed??!

 
Giovanni Montano
Ranch Hand
Posts: 600
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Omar Muhammed wrote:Let's say I have a simple service -launched by MainActivity- which is displaying a toast every x second. I know that my service will be killed if the user decided to kill MainActivity - which started it. What is to do if i want this service to keep running as long as the app is installed??!


well user want that if the app is killed so are the services! For security reasons. Would you imagine you close the app and a key logger is listening what you are writing?

the other way around is you have a mediaplayer and want to make the music playing if user switches to another application. in this case  you are not killing the app. And this is the user case I suggest you should adress
 
Omar Muhammed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, when i say "app is killed" i mean specifically the force stop by the user.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If user forcibly stop an apps then it will not show again. But in some cases we found thats happening. So I think there is another backdoor.
 
Omar Muhammed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Simone Zeffiro wrote:If user forcibly stop an apps then it will not show again. But in some cases we found thats happening. So I think there is another backdoor.


Then, Do you have any idea about that?
 
Giovanni Montano
Ranch Hand
Posts: 600
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Omar Muhammed wrote:

Simone Zeffiro wrote:If user forcibly stop an apps then it will not show again. But in some cases we found thats happening. So I think there is another backdoor.


Then, Do you have any idea about that?

did you look pending Intent? the link I sent to you?
 
Could you hold this puppy for a sec? I need to adjust this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic