how to copy email-id as a contact from phone memory to SIM

82 views
Skip to first unread message

Abhishek Kumar Gupta

unread,
Aug 2, 2011, 6:23:26 AM8/2/11
to android-...@googlegroups.com
Is it possible to copy email-id as a contact from phone memory to SIM? If yes, then please provide any related reference.
Any help will be well appreciated.

Abhishek Kumar Gupta

unread,
Aug 5, 2011, 2:32:15 AM8/5/11
to android-...@googlegroups.com
Can anyone provide information that whether SIM Database support "Email" data type or not?

ABTHUL RAZEETH

unread,
Aug 5, 2011, 6:37:25 AM8/5/11
to android-...@googlegroups.com
3G SIm supports.

On Fri, Aug 5, 2011 at 12:02 PM, Abhishek Kumar Gupta <akgae...@gmail.com> wrote:
Can anyone provide information that whether SIM Database support "Email" data type or not?


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/b8V4qKCa1sYJ.

To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.



--
With Regards
Abthul Razeeth

Abhishek Kumar Gupta

unread,
Aug 5, 2011, 7:17:46 AM8/5/11
to android-...@googlegroups.com
Just now , I saw in some link that USIM supports this. And I guess 3G SIM would be a USIM, surely.

Coming to the implementation part, can this be implemented with existing android framework level code. Or any modification in RIL, is required to implement this?

Abhishek Kumar Gupta

unread,
Aug 8, 2011, 6:15:22 AM8/8/11
to android-...@googlegroups.com
private static final Uri SIM_CONTENT_URI = Uri.parse("content://icc/adn");

ContentResolver cr=getContentResolver();
                    Cursor cursor = cr.query(SIM_CONTENT_URI, null, null, null, null);
ContentValues cv = new ContentValues();
                    cv.put("tag", "ABHISHEK");
Uri uri = cr.insert(SIM_CONTENT_URI, cv);

Uri emailUri = null;
 emailUri = Uri.withAppendedPath(uri, People.ContactMethods.CONTENT_DIRECTORY);
cv.clear();
cv.put(People.ContactMethods.KIND, Contacts.KIND_EMAIL);
                    cv.put(People.ContactMethods.DATA, "te...@example.com");
                    cv.put(People.ContactMethods.TYPE, People.ContactMethods.TYPE_HOME);
                    getContentResolver().insert(emailUri, cv);

The stack trace is :

08-08 06:52:27.938: ERROR/DatabaseUtils(385): Writing exception to parcel
08-08 06:52:27.938: ERROR/DatabaseUtils(385): java.lang.UnsupportedOperationException: Cannot insert into URL: content://icc/adn/0/contact_methods
08-08 06:52:27.938: ERROR/DatabaseUtils(385):     at com.android.internal.telephony.IccProvider.insert(IccProvider.java:319)
08-08 06:52:27.938: ERROR/DatabaseUtils(385):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:198)
08-08 06:52:27.938: ERROR/DatabaseUtils(385):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:156)
08-08 06:52:27.938: ERROR/DatabaseUtils(385):     at android.os.Binder.execTransact(Binder.java:320)
08-08 06:52:27.938: ERROR/DatabaseUtils(385):     at dalvik.system.NativeStart.run(Native Method)
08-08 06:52:27.938: WARN/dalvikvm(1109): threadid=1: thread exiting with uncaught exception (group=0x4002d560)
08-08 06:52:27.948: ERROR/AndroidRuntime(1109): FATAL EXCEPTION: main
08-08 06:52:27.948: ERROR/AndroidRuntime(1109): java.lang.UnsupportedOperationException: Cannot insert into URL: content://icc/adn/0/contact_methods
08-08 06:52:27.948: ERROR/AndroidRuntime(1109):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:146)
08-08 06:52:27.948: ERROR/AndroidRuntime(1109):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
08-08 06:52:27.948: ERROR/AndroidRuntime(1109):     at android.content.ContentProviderProxy.insert(ContentProviderNative.java:443)
08-08 06:52:27.948: ERROR/AndroidRuntime(1109):     at android.content.ContentResolver.insert(ContentResolver.java:604)
Reply all
Reply to author
Forward
0 new messages