Reputation: 58
I click on the "home" button to run in the background app.A few hours later I open the app again,but it run the OnCreate()
method.I tried to used the android:alwaysRetainTaskState
attribute and I saw it didn't change anything. So what should I do?
Upvotes: 1
Views: 213
Reputation: 1699
If u want to run any task in background use services as @Babibu said. here is a link which may help u out. http://www.vogella.com/articles/AndroidServices/article.html go through examples in it.
Upvotes: 0
Reputation: 32231
Activities cannot be run in background. There for we got services. Espacialy look at startForeground, but it also have it's limitations. There isn't any other way.
Upvotes: 6