pedd Mylast
pedd Mylast

Reputation: 67

Service and Activity process

I have an service with one activity , I want to have different process for service than activity , I have did it with :

android:process=":MA_TEST"

but there is a problem

in task manager , if I end my activity , It will closes service automatically , I want my service works really on different process than activity .

Also How can I hide my activity from task manager ?

thanks.

Upvotes: 1

Views: 211

Answers (2)

Chris Stratton
Chris Stratton

Reputation: 40357

From the adb shell you should be able to use the 'ps' command to verify that the service has its own process entry distinct from the rest of the appliction.

On the emulator, adb runs as root, so you could specifically kill the non-service process by its PID. The service should not directly die as a result of that, though this may make it reapable by Android if it means that the service no longer has any connection to the user.

This is more for purposes of understanding, as specific-pid-killing would not be available on a secured device.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006819

I want to have different process for service than activity

Why? This wastes system resources (RAM, CPU) and is usually not needed.

in task manager , if I end my activity , It will closes service automatically

Whatever your "task manager" is does not "end" an "activity", but rather stops your application, which would include all processes.

Also How can I hide my activity from task manager ?

You cannot, for obvious security reasons.

Upvotes: 1

Related Questions