Reputation: 2044
App is for my personal use, so no issue with Play store policies.
For regular phone number the SmsManager
works perfectly.
I have something different.
I am receiving message from some special number ex. [email protected], see snap from sms details. Note: In above number the Numeric value is not phone number.
First I will show you how I am working
I have created below observer and I am getting message properly.
String url = "content://sms/";
Uri uri = Uri.parse(url);
this.getApplicationContext().getContentResolver()
.registerContentObserver(uri, true, new MessageObserver(new Handler(), this));
Now in this I used content observer to fetch the message details like below.
Uri loUriAllMessages = Uri.parse("content://sms/");
Cursor loCursor = moContext.getContentResolver().query(
loUriAllMessages, null, null, null, "_id DESC");
if (loCursor != null && loCursor.getCount() > 0) {
Log.i(TAG, "Cursor Count: " + loCursor.getCount());
if (loCursor.moveToFirst()) {
final int liMessageId = loCursor.getInt(loCursor
.getColumnIndex("_id"));
final String lsMessageText = loCursor.getString(loCursor
.getColumnIndex("body"));
String lsPhoneNumber = loCursor.getString(loCursor
.getColumnIndex("address"));
final String lsDate = loCursor.getString(loCursor
.getColumnIndex("date"));
String lsType = loCursor.getString(loCursor.getColumnIndex("type"))
.trim();
long llTime = Long.parseLong(lsDate);
}
}
All above things work perfectly.
In lsPhoneNumber
field I am getting [email protected]
Now from my app if I send message using SmsManager
on this number then it did not working, all message fail.
SmsManager smsManager = SmsManager.getDefault();
ArrayList<String> loParts = smsManager.divideMessage(message);
smsManager.sendMultipartTextMessage(number, null, loParts, null, null);
But if I go to Messaging app and use same above in send To field and send message then successfully sent on that number.
In short manually sending on the same working fine, But using SmsManager
getting fail.
Hopping for the proper guidelines.
Upvotes: 1
Views: 241