Earlier i got errors of permission, but then i asked user for permission and now i am not getting any error. But still not able to send MMS. Help is appreciated. Thanks.
Following is the source code,
try {
if (requestCode == RESULT_LOAD_GALLERY_IMAGE && resultCode == RESULT_OK &&
null != data) {
Uri uri = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(uri, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
Log.d(TAG, uri.toString());
Cursor cur = null;
if (Utils.hasKitKat()) {
cur = SqliteWrapper.query(context, context.getContentResolver(),
Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"),
APN_PROJECTION, null, null, null);
} else {
cur = context.getContentResolver()
.query(Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"),
null, null, null, null);
}
cur.moveToLast();
String type = cur.getString(cur.getColumnIndex(Telephony.Carriers.TYPE));
String mmsc = cur.getString(cur.getColumnIndex(Telephony.Carriers.MMSC));
String proxy = cur.getString(cur.getColumnIndex(Telephony.Carriers.MMSPROXY));
String port = cur.getString(cur.getColumnIndex(Telephony.Carriers.MMSPORT));
cur.close();
Bitmap myImg = Bitmap.createBitmap(getResizedBitmap(getUnRotatedImage(picturePath,
BitmapFactory.decodeFile(picturePath)), 400));
sendImage.setImageBitmap(myImg);
Settings settings = new Settings();
settings.setMmsc(mmsc);
settings.setProxy(proxy);
settings.setPort(port);
settings.setUseSystemSending(true);
Transaction transaction = new Transaction(MainActivity.this, settings);
Message message = new Message("Hello test mms", "9879655222");
message.setImage(myImg);
transaction.sendNewMessage(message, Transaction.NO_THREAD_ID);
}
} catch (Exception e) {
Log.d(TAG, "Error in load image." + e);
}
Earlier i got errors of permission, but then i asked user for permission and now i am not getting any error. But still not able to send MMS. Help is appreciated. Thanks.
Following is the source code,