-1

i need to do something at the background but i need this service alive once the app turn on

although , i need to do at background always even the phone at sleep mode ??

i try to do service but this service after the phone go to sleep mode the service still alive but don't work what i attach to it.

using this

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AlarmService_Service.html

i see this link , but i don't get the idea !!!

Community
  • 1
  • 1
Hanaa
  • 87
  • 1
  • 2
  • 10

1 Answers1

0

Why can't you use

Intent intent = new Intent(MyActivity.this, Myservice.class);
startService(intent);

If you do that in the onCreate method of your Activity then it will start the service as soon as your Activity is ran. From there, it should be running in the background. What is the issue your having?

Frank Sposaro
  • 8,511
  • 4
  • 43
  • 64