3

Is there a way to read sms from inbox using flash? I'm using flash to create an app. I've created native extension using eclipse and flash builder. The java code i used is:

FREObject result = null;
Bundle bundle = intent.getExtras();
String msgData = "";
if (bundle != null)
{
    Uri uri = Uri.parse("content://sms/inbox");
    Cursor cursor = context.getActivity().getContentResolver().query(uri, null, null, null, null);
    cursor.moveToFirst();

    do{
         for(int idx=0;idx<cursor.getColumnCount();idx++)
         {
             msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);
         }
    }
    while(cursor.moveToNext());
    try
    {
            result = FREObject.newObject(msgData);
    }
    catch (FREWrongThreadException e)
    {
        Log.e(DeviceInfoExtension.TAG, "ErrorRead: "+e.getMessage(), e);
    }
   }
  return result;

I couldn't figure out what's wrong ? Any help would be appreciated.

BadFeelingAboutThis
  • 14,445
  • 2
  • 33
  • 40
TheGunners
  • 185
  • 1
  • 13
  • did you ever get this figured out? – tamak Oct 22 '14 at 21:20
  • Yes. I used following code: FREObject result = null; String msgData = ""; Uri uri = Uri.parse("content://sms/inbox"); Cursor c= context.getActivity().getContentResolver().query(uri, null, null ,null,null); // startManagingCursor(c); c.moveToFirst(); String body = c.getString(c.getColumnIndexOrThrow("body")).toString(); String number = c.getString(c.getColumnIndexOrThrow("address")).toString(); //String phoneNumber = "+977xxxxxxxxxx"; c.close(); – TheGunners Nov 09 '14 at 09:17

0 Answers0