klinker41 / android-smsmms

Library for easily sending SMS and MMS for Android devices
673 stars 247 forks source link

Feature: Could accept an Parcelable on sendNewMessage() #126

Closed amadeu01 closed 6 years ago

amadeu01 commented 6 years ago

It would be great to be possible to add extras to the sentMessageIntent and deliveryIntents

So, one manner of doing that is by passing a Parcelable throughout the functions calls, and then the library could add them to their intents.

Then I could be even easier to find out which SMS was sent we the Receiver is called. Once the Parcelable will come with the intent passed to the Receivers

            Intent sentMessageIntent = new Intent(SENT);
            sentMessageIntent.putExtra(SENT_SMS_BUNDLE, message);

            PendingIntent sentIntent = PendingIntent
                    .getBroadcast(mContext, (int) System.currentTimeMillis(), sentMessageIntent,
                            PendingIntent.FLAG_UPDATE_CURRENT);

            Intent delivered = new Intent(DELIVERED);
            delivered.putExtra(DELIVERED_SMS_BUNDLE, message);

            PendingIntent deliveryIntent = PendingIntent
                    .getBroadcast(mContext, (int) System.currentTimeMillis(), delivered,
                            PendingIntent.FLAG_UPDATE_CURRENT);

            sentIntents.add(sentIntent);

            deliveryIntents.add(deliveryIntent);

https://github.com/klinker41/android-smsmms/blob/a1a3f91f4481371646ec22421a7d8f1fbba8ddcf/library/src/main/java/com/klinker/android/send_message/Transaction.java#L182

https://github.com/klinker41/android-smsmms/blob/a1a3f91f4481371646ec22421a7d8f1fbba8ddcf/library/src/main/java/com/klinker/android/send_message/Transaction.java#L118

NickM-27 commented 6 years ago

This would be a great idea, definitely would help me a lot in making things easier, I might look into making a pull request for this

amadeu01 commented 6 years ago

@NickM-27 I did a PR for this, if you have the time, I would appreciate you having a look at it.

NickM-27 commented 6 years ago

@amadeu01 Looks good to me

amadeu01 commented 6 years ago

@klinker24 could you have a look at the PR? really thanks 😄