Android in-app multi-process

Source: Internet
Author: User

Do Android 1 years today found an application can also have multiple processes, here to record

Android has only one main process by default, and 4 large components are running in the same main process

However, service, broadcast, activity provider can start a new process by specifying android:process to run

A third-party library was referenced in the project, and Android.os.Process.killProcess (Android.os.Process.myPid ()) was called when exiting the application, killing the current process

And we integrated the Aurora push led to the Aurora push service also lost, the application after the exit will not receive the push

What to do, to put the Aurora push Jpushservice into a separate process to go, the above code will only kill the main process, will not kill other processes

<ServiceAndroid:name= "Cn.jpush.android.service.PushService"android:enabled= "true"android:process= ": Jpushservice" ><Intent-filter><ActionAndroid:name= "Cn.jpush.android.intent.REGISTER" /><ActionAndroid:name= "Cn.jpush.android.intent.REPORT" /><ActionAndroid:name= "Cn.jpush.android.intent.PushService" /><ActionAndroid:name= "Cn.jpush.android.intent.PUSH_TIME" /></Intent-filter></Service><ServiceAndroid:name= "Cn.jpush.android.service.DownloadService"android:enabled= "true"android:process= ": Jpushservice" ></Service>

Open DDMS can see our app now has 2 processes running, back key out of the main process to destroy, Jpushservice is still in the process

Android in-app multi-process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.