Android - Buttons supported in notification expanded view?
I am trying to get buttons to work in notification expanded view. The goal is to use the buttons to launch activities from the notification view. Is this even supported? Here is a very simple outline with irrelevant details omitted:
- Create a RemoteView object using a layout with some ImageButtons.
- Create pending intent for each button and set them using RemoteView.setOnClickPendingIntent(...)
- Create a Notification object and set it's contentView as the RemoteView created in step 1.
- Set Notification object's contentIntent.
- Send the Notifi开发者_StackOverflowcation.
This works beautifully on my Droid X. I can click on each button and launch it's associated activity successfully.
This works on my pal's Evo 4G as well, except that it launches the button's intent plus the notification's content intent. So two intents launched. But I can deal with that.
This also works on HTC Incredible.
Unfortunately, it doesn't work on most other phones: Vibrant, Hero, Vision, WildFire, MIleStone, Droid 1. These are the ones I know so far based on user feedback. On these phones, only the notification contentIntent is being launched. It appears the button's click events aren't being captured/detected.
I am at my wit's end trying to work around this. I am beginning to think it's impossible, but it works on some phones! Any suggestion/help is appreciated.
Thanks!
精彩评论