Reputation: 273
I am making an application in which i am using broadcast reciever to call a service. The problem is that I have to open the application to make the service work. I want that just install application and it will run the service automatically.
In the main activity I have used Intent filter and I have made a class for brodcast reciever and called onRecieve method
Upvotes: 2
Views: 1236
Reputation: 75
You can use the startforeground()
method in your service to avoid getting it killed.
Upvotes: 0
Reputation: 9326
If you want to run something in background it should be a Service. It was designed specifically for this purpose. The sole purpose of an Activity is user interaction.
Upvotes: 4