创建在收件箱中的Andr​​oid彩信保存/收件箱、彩信、Andr、oid

2023-09-04 03:28:21 作者:碧海青天夜夜心

我工作的这需要能够/创建在收件箱中的新的彩信或发送文件夹,但我不能想出的方式来保存应用程序。

I am working on an Application which needs to be able to Save/Create a new MMS in inbox or Sent folders but I cant figure out the way.

我尝试以下code,但它给了我异常:

I tried the following code but it gave me exception:

ContentValues values = new ContentValues();
values.put("address", "xxxxxxxxxxx");
values.put("body", "body 3");
values.put("read", "0");
getContentResolver().insert(Uri.parse("content://mms/inbox"), values);

和唯一的例外是:

ERROR/Database(118): Error inserting read=0 body=body 3 msg_box=1 date=1306153444 address=xxxxxxxxxxx
ERROR/Database(118): android.database.sqlite.SQLiteException: table pdu has no column named body: , while compiling: INSERT INTO pdu(read, body, msg_box, date, address) VALUES(?, ?, ?, ?, ?);
ERROR/Database(118):     at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
ERROR/Database(118):     at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
ERROR/Database(118):     at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
ERROR/Database(118):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:80)
ERROR/Database(118):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:36)
ERROR/Database(118):     at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1145)
ERROR/Database(118):     at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1536)
ERROR/Database(118):     at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1410)
ERROR/Database(118):     at com.android.providers.telephony.MmsProvider.insert(MmsProvider.java:347)
ERROR/Database(118):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:174)
ERROR/Database(118):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:146)
ERROR/Database(118):     at android.os.Binder.execTransact(Binder.java:288)
ERROR/Database(118):     at dalvik.system.NativeStart.run(Native Method)
ERROR/MmsProvider(118): MmsProvider.insert: failed! read=0 body=body 3 msg_box=1 date=1306153444 address=xxxxxxxxxxx

UDPATE:例外通过删除行中删除: values​​.put(身体,体3)但我不能看到消息的任何彩信。

UDPATE: Exception removed by removing the line: values.put("body","body 3") But I can't see any mms in messages.

推荐答案

我有同样的问题。不过,我成功地创建和恢复彩信。它基本上是反向操作的数据库。我希望你可以从数据库中MMS,对不对?你只需要放回到适当的值在数据库表中。您可以获取有关mmssms.db数据库表中的信息。一旦你理解了mmssms.db,它很容易插入彩信。

I was having the same problem. However I successfully created and restored an MMS. It's basically reverse manipulation of database. I hope you can get an MMS from the database, right? You just need to put back appropriate values in database tables. You can get information about database tables in mmssms.db. Once you understand the mmssms.db, it's very easy to insert an MMS.