Android:在特定threadId位置删除SMS [英] Android: Delete SMS at particular threadId location
问题描述
我试图了解电话及其上软件之间的区别.我在Droid Incredible上进行编码和测试. content://sms
的内容查看器工作正常,我可以删除不可思议"上的threadId,但是我的应用在Moto Droid Milestone上崩溃了.我使用Milestone模拟器程序包使用Moto Dev Studio测试了Milestone.它可以在仿真器中正常运行,但不能在实际设备上运行.
I am trying to understand the difference between phones, and the software on them. I code and test on the Droid Incredible. A content observer of content://sms
works fine and I am able to delete threadIds on the Incredible, but my app crashes on the Moto Droid Milestone. I test for the Milestone using Moto Dev Studio using the Milestone emulator package. It works fine in the emulator, but not on the actual device.
为什么content://sms在不可思议"上能正常工作,但在里程碑上却不能正常工作?为什么要在Milestone仿真器上而不是Milestone设备上运行它?
Why would content://sms work fine on the Incredible, but not on the Milestone? Why would it on work on the Milestone emulator and not on the Milestone Device?
这种删除方法如下所示,其中uri为content://sms + threadId
Such a delete method is shown below with the uri being content://sms + threadId
getContentResolver().delete(deleteUri, "address=? and date=?", new String[] {msg.getOriginatingAddress(), String.valueOf(msg.getTimestampMillis())});
许多人说这样的内容观察器不是SDK的一部分.明白了如何出于正当理由删除短信,例如使用密码创建一个单独的应用程序,该密码用于存储与短信互不相同的短信,而短信与主短信系统分开?
Many people say such a content observer is not part of the SDK. Understood. How can I delete an sms for legitimate reasons such as creating an separate application with a password that stores sms messages separate and apart from the main text messaging system?
推荐答案
为什么content://sms可以正常工作 难以置信,但不是 里程碑
Why would content://sms work fine on the Incredible, but not on the Milestone
因为我不断指出,content://sms
不是Android SDK的一部分.没有理由要相同.欢迎设备制造商对其进行更改,消除它等等. Google告诉您不要使用它一个>.日历内容提供者已经进行了类似的修订,对应用程序产生了类似的影响.这些只是提供程序的一部分,它们是应用程序的一部分,并非供开发人员使用.
Because, as I keep pointing out, content://sms
is not part of the Android SDK. There is no reason for it to be the same. Device manufacturers are welcome to change it, eliminate it, and so forth. Google has told you not to use it. The Calendar content provider has already undergone similar revisions with similar impacts on applications. These are simply providers that are part of applications, they are not meant to be used by developers.
如何删除合法的短信 诸如创建单独的原因 带有密码的应用程序 分别存储短信 来自主要的短信系统.
How can I delete an sms for legitimate reasons such as creating an separate application with a password that stores sms messages separate and apart from the main text messaging system.
您不能从其他SMS应用程序中删除消息,也不能停留在SDK的范围之内.尝试从SMS内容提供程序中删除消息可能根本无法在某些设备上运行,可能对其他设备没有影响,并可能导致其他应用程序在其他设备上崩溃,等等.
You cannot delete messages from other SMS applications and stick within the bounds of the SDK. Trying to delete messages from the SMS content provider simply may not work on some devices, may have no effect on other devices, may cause other applications to crash on still other devices, and so forth.
为此,您不能创建单独的SMS应用程序,也不能将其限制在SDK的范围内,因为您需要接收的Intent
没有记录(尽管众所周知).例如,某些设备制造商选择改变此Intent
来使用其他操作并非不可能.至少在某种程度上不太可能,因为这将是操作系统的更改,而不是对某些随机应用程序(例如,所谓的SMS内容提供者的主页Messaging)的更改.但是,有可能.
For that matter, you cannot create a separate SMS application and stick within the bounds of the SDK, since the Intent
you need to receive is undocumented (though widely known). It's not out of the realm of possibility for some device manufacturer to elect to change up this Intent
to use a different action, for example. This is at least somewhat less likely, as this would be an OS change rather than a change to some random app (e.g., Messaging, home of the so-called SMS content provider). However, it is possible.
这篇关于Android:在特定threadId位置删除SMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!