Start a service from Thread.UncaughtExceptionHandler?

前端 未结 1 572
礼貌的吻别
礼貌的吻别 2021-01-06 07:22

I\'m trying to setup a global exception handling service as mentioned in this answer. This approach sounds logical because after a crash, the code in my custom Thread.Uncaug

相关标签:
1条回答
  • 2021-01-06 07:27

    Ah, I figured this out. The key was to add android:process to the manifest, which forces the service to launch in a seperate process. This prevents the service from being killed when the application is killed.

    <service
        android:name="your.package.blah.blah.MyExceptionService"
        android:process=":exception" >
        <intent-filter>
            <action android:name="your.package.blah.blah.REPORT" />
        </intent-filter>
        </service>
    
    0 讨论(0)
提交回复
热议问题