Matthias,
Referring to the code in your related question. When you create an Intent that PendingIntent will run instead of just giving it an Action String , you can add additional information to it to determine which SMS it belongs to ...
Intent sentIntent = new Intent(SENT); sentIntent.putExtra("smsNumber", someValue); PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, sentIntent, FLAG_UPDATE_CURRENT); Intent deliveredIntent = new Intent(DELIVERED): deliveredIntent.putExtra("smsNumber", someValue); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, deliveredIntent, FLAG_UPDATE_CURRENT);
Thus, you should be able to get the value "smsNumber" inside the BroadcastReceiver
Hope this helps!
Edit Matthias Lin: It is important that you pass the FLAG_UPDATE_CURRENT flag with the expectation that additional data is transmitted and actually received with the broadcast.
source share