I am developing an android application in which I want to read the sms and pass the data to my application.
I tried many ways but cant't figure it out. Here is what I am doing. Is something wrong in my code.
String msg_body = "";
Uri my_uri = Uri.parse("content://sms/inbox");
Cursor readFstSms = v.getContext().getContentResolver().query(my_uri, null, null, null, null);
if(readFstSms.moveToFirst())
{
msg_body = readFstSms.getString(readFstSms.getColumnIndexOrThrow("body")).toString();
}
readFstSms.close();
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + msg_body);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
I also added <uses-permission android:name="android.permission.READ_SMS"/>
in my manifest file but still can't find the solution