1

我的应用程序适用于标准的 android 联系人,因此我的权限如下AndroidManifest.xml

<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />

唉,当我清除标准联系人应用程序的用户数据(设置 -> 应用程序 -> 管理应用程序 -> 全部 -> 联系人 -> 清除数据)时,我的应用程序com.example.dialer重新启动:

04-05 15:39:21.161 I/InstalledAppDetails( 9019): Clearing user data for package : com.android.providers.contacts
04-05 15:39:21.181 I/Process (  252): Sending signal. PID: 8774 SIG: 9
04-05 15:39:21.181 I/Process (  252): Sending signal. PID: 8761 SIG: 9
04-05 15:39:21.181 I/Process (  252): Sending signal. PID: 8368 SIG: 9
04-05 15:39:21.181 I/ActivityManager(  252): Force stopping package com.android.providers.contacts uid=10017
04-05 15:39:21.181 I/ActivityManager(  252): Kill com.sonyericsson.android.socialphonebook (pid 8774): provider com.android.providers.contacts.SemcContactsProvider2 in dying process android.process.acore
04-05 15:39:21.181 I/ActivityManager(  252): Kill com.example.dialer (pid 8761): provider com.android.providers.contacts.SemcCallLogProvider in dying process android.process.acore
04-05 15:39:21.231 D/dalvikvm( 9019): GC_CONCURRENT freed 1572K, 52% free 3798K/7815K, external 4576K/5694K, paused 1ms+4ms
04-05 15:39:21.251 E/InputDispatcher(  252): channel '2b440330 com.example.dialer/com.example.dialer.Dialer (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
04-05 15:39:21.251 E/InputDispatcher(  252): channel '2b440330 com.example.dialer/com.example.dialer.Dialer (server)' ~ Channel is unrecoverably broken and will be disposed!
04-05 15:39:21.251 I/WindowManager(  252): WINDOW DIED Window{2b440330 com.example.dialer/com.example.dialer.Dialer paused=false}
04-05 15:39:21.261 I/ActivityManager(  252): Process com.example.dialer (pid 8761) has died.
04-05 15:39:21.261 W/ActivityManager(  252): Scheduling restart of crashed service com.example.dialer/.ContactsService in 5000ms
04-05 15:39:21.281 I/InstalledAppDetails( 9019): Cleared user data for package : com.android.providers.contacts

是否可以阻止这种情况并改为更新我的应用程序的状态?

4

1 回答 1

0

AFAIK, if your app contains CONTACT related permissions, means your app is associated with contact app somehow and is dependent on that.

When user cleared the contact app data, whole Contact package is restarted by the system(you can see in logs). That means all applications having CONTACTS related permissions will be restarted.

So I don't think you can stop this.

于 2012-04-10T13:10:40.623 回答