I finally got my app to be able to send text messages (SMS), but the problem now is that i need the messages to show up in the inbox if the user opens the sms app.
Is there any way to add text messages to the inbox?
I'm currently using the following code, could i alter it somehow to make it show up in the inbox?
private void sendSMS(String phoneNumber, String message)
{
PendingIntent pi = PendingIntent.getActivity(ccc, 0, new Intent(), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, pi, null);
}
This link has an example of how to do it.
This function in the code does it, the complete example uses a service to accomplish the task:
private void addMessageToSent(String telNumber, String messageBody) {
ContentValues sentSms = new ContentValues();
sentSms.put(TELEPHON_NUMBER_FIELD_NAME, telNumber);
sentSms.put(MESSAGE_BODY_FIELD_NAME, messageBody);
ContentResolver contentResolver = getContentResolver();
contentResolver.insert(SENT_MSGS_CONTET_PROVIDER, sentSms);
}
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With