我想在 Android 应用程序在 ANDROID 中卸载时删除联系人组(在安装时创建)
我有代码可以像这样删除具有联系人组 id 的联系人组,并且也正在工作...
ContentValues values = new ContentValues();
values.put(ContactsContract.Groups._ID, 4444);
getContentResolver().delete(ContactsContract.Groups.CONTENT_URI,values.toString(),null);
但我想在 Android 设备中卸载应用程序时执行此删除。所以我必须做什么或卸载时可以使用哪些功能?
那么你能给我推荐一些东西吗?
I have code to delete the contact group with the contact group id like this and is also working...
ContentValues values = new ContentValues();
values.put(ContactsContract.Groups._ID, 4444);
getContentResolver().delete(ContactsContract.Groups.CONTENT_URI,values.toString(),null);
but I want to perform this deletion at the time of un-installation of the application in Android device.So what I have to do or which function can be used at uninstalling time?
So can you suggest me something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,卸载应用程序后您无法获得控制权或执行任何任务。
不幸的是,当前 Android 包无法在删除后执行代码。不过,您可以在不同的程序包中为
ACTION_PACKAGE_REMOVED
注册一个BroadcastReceiver
,当程序包从手机中删除时,将调用该程序包。看看这个问题在android中执行卸载任务
Sorry, You cannot get control or perform any task when your application is uninstalled.
Unfortunately there is currently no way for an Android package to execute code when it is removed. However, you can register a
BroadcastReceiver
forACTION_PACKAGE_REMOVED
in a different package that will be called when packages are removed from the phone.Look at this question Perform a task on uninstall in android