First: these (sms, calendar, email) are not supported by the public API.
What is you problem exactly? (for instance: you got an exeption with some
error msg)
Did you set the read sms permission?

Another tip: you can dump your cursor with the DatabaseUtils dump functions
very easily.
For example you could use the DatabaseUtils.dumpCurrentRowToString method to
dump a row to a string and log the result.

http://developer.android.com/reference/android/database/DatabaseUtils.html#dumpCurrentRowToString%28android.database.Cursor%29

(and dont forget to close your cursor :) )


On 23 May 2011 22:23, Hitendrasinh Gohil <[email protected]>wrote:

> hi,
>
> How can i read all the messages from sim as well as phone.
>
> I have tried the below code but not success yet.
>
>  public static void getAllSMS(Context context)
>   {
>           try
>           {
>                   Uri allMessage = Uri.parse("content://sms/");
>                   ContentResolver cr = context.getContentResolver();
>                   Cursor cursor = cr.query(allMessage, null, null, null,
> null);
>                   int count = cursor.getCount();
>                   if (count > 0)
>                   {
>
> cursor.moveToFirst();
>                           long messageId = cursor.getLong(0);
>                           long threadId = cursor.getLong(1);
>                           String address = cursor.getString(2);
>                           long contactId = cursor.getLong(3);
>                           String contactId_string =
> String.valueOf(contactId);
>                           long timestamp = cursor.getLong(4);
>                           String body = cursor.getString(5);
>                   }
>
>
>           }
>           catch (Exception e)
>           {
>                   e.printStackTrace();
>           }
>   }
>
> and for email and calendar events ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to