Build Long-term Service android

457 views Asked by At

am trying to build android long-term service/intentService application. after user open the application it has only one activity with single EditText to allow user input Authentication login code after user input that the application should running subclass of WakefulBroadcastReceiver, and this subclass having alarm manager to running an intentService every 10mins

i am implemented this example but after one day the application doesn't back to send or receive message from the server

is there any practice can help to make application running the whole time

1

There are 1 answers

0
Jitin Jassal On

Android stops normal service after some time(due to memory request) You can Override this method in your service class to start the service again after it is stopped.

@Override
public int onStartCommand(Intent intent, int flags, int startId) {

    return START_STICKY;

}

Also have a look at this question.