I\'m trying to make a notification with 2 buttons on it:
Has anyone got an idea o
If you want to assign specific intent to a button:
views.setOnClickPendingIntent(R.id.your_button_id, pendingIntent);
I suppose that you need only one intent to be sent when the button is clicked, so you have to AVOID setting the main notification intent
notification.contentIntent = yourPendingIntent;
Otherwise (if you set "notification.contentIntent = pendingIntent;" as usual) both intents will be called which might not be what you want/user expects.
If you still want pressing other parts of the notification invoke that general intent (or any other) you can use the same method of intent-per-view assignment as above. Don't forget to set
android:clickable="true"
to any view you'd like to track onClick() for.
You can track these intents by their extras in the activity they are calling. If you are calling you main/launcher activity than you'll track them here (as it comes from javadoc for this method):
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Bundle data = intent.getExtras();
if (data != null && data.containsKey(YOUR_INTENT_KEY_SOURCE_CONSTANT)) {
// process your notification intent
}
// go on with smth else
}