1. Download our Official Android App: Forums for Android!

Apps How to Prevent Android os kill process(want app continuously running)

Discussion in 'Android Development' started by amitsharma_ujj, Dec 31, 2012.

  1. amitsharma_ujj

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Dec 31, 2012

    Dec 31, 2012
    3
    0
    5
    Hello Friend,

    I am developing chatting app in which i have to run my app continuously in background also. but unfortunately sometime my app kill by Android OS. and i have to relogin. Is there any way to run my app continuously in background. Some App is available on Google play which is running in background.

    Please help me to run my app continuously .
    Thanks in Advance
     

    Advertisement

  2. scary alien

    scary alien not really so scary
    Moderator
    Rank:
     #9
    Points:
    2,138
    Posts:
    22,146
    Joined:
    Mar 5, 2010

    Mar 5, 2010
    22,146
    23,268
    2,138
    Male
    space alien ;)
    Indy
    Welcome to the AndroidForums, amitsharma_ujj :).

    I'm not sure you'll be able to...my experience is that Android may kill a background process at any time.

    I have an app that has a background service and all I could do was try to gracefully recover from the termination.

    There may indeed be methods that I'm not aware of, but short of having the app in the foreground, I'm afraid Android might keep killing your background process.

    Maybe someone else with other thoughts or information will chime in.

    Anyway, thanks for signing-up with us here at AF.
     
  3. myrecek

    myrecek Newbie
    Rank:
    None
    Points:
    16
    Posts:
    29
    Joined:
    May 10, 2012

    May 10, 2012
    29
    2
    16
    You can consider using startForeground in your service. As the docu says:

    The Service will still run in background with an icon in notification area.
     
    scary alien likes this.
  4. amitsharma_ujj

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Dec 31, 2012

    Dec 31, 2012
    3
    0
    5
    Thank for your reply...

    can i have any reference startForeground Services ? i did goggle but not get the exact example.
     
  5. myrecek

    myrecek Newbie
    Rank:
    None
    Points:
    16
    Posts:
    29
    Joined:
    May 10, 2012

    May 10, 2012
    29
    2
    16

Share This Page

Loading...