2013-01-09 36 views
0

我用是否有可能得到ACTION_DELETE意图回调

Uri packageURI = Uri.parse("package:com.any.app"); 
Intent intent = new Intent(Intent.ACTION_DELETE, packageURI); 
startActivity(intent); 

删除软件包,但我不能让回调或删除操作完成后,删除成功事件。

我搜索了很多,但没有线索,是否有可能得到ACTION_DELETE回调?

The Chinese word "确定" on image means "confirm"

事件触发的确认按钮的对话框

回答

0

最后,我发现thisthis。 观察安装或删除软件包的方法是添加广播以接收意图。 希望这可以帮助别人。

0

有在Intent.See一个ACTION_PACKAGE_FULLY_REMOVED详情here

但要小心,Intent.ACTION_PACKAGE_FULLY_REMOVED的API级别为14 如果你的应用是14岁以下,你可以试试这个。 首先,创建一个广播接收器“UninstallReceiver”。然后声明它AndroidManifest.xml.My声明是这样的

<receiver android:name="com.example.manager.Broadcast.UninstallReceiver" > 
     <intent-filter> 
      <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" /> 
      <data android:scheme="package" /> 
     </intent-filter> 
</receiver>" 

当您发送Intent.ACTION_DELETE,如果应用程序是完全卸载后,可以在您的BroadcastReceiver中接收广播,然后您可以做任何您想要的。

相关问题