2

In samsung galaxy tab 2 when phone app goes to background, we can interact with phone app from notification. it has all the buttons and information that we need. enter image description here

How can i implement notification like this?

4

1 に答える 1

3

まず第一に、機能ボタンをNotification実行中のデバイスHoneycombまたはそれ以降のデバイスに追加できます。はい、一部の以前のHoneycombデバイスにはそのような種類がありますがNotifications、そのようなものを作成できたのはデバイス メーカーだけです (またはNotificationsの例)。DialerMusic Player

このような通知を使用するには、customViewfor を使用できますNotification( を参照してくださいRemoteViews)。

より簡単な方法 (および推奨される方法) は、メソッドを使用NotificationCompat.Builderして使用することです。このaddActionメソッドは、ボタンがクリックされたときに、指定したボタンを追加してNotification実行しPendingIntentます。これは以前のHoneycombデバイスでも機能します。つまり、古いデバイスではボタンが表示されません。

編集: Vogella : Android Notificationsのこの素晴らしいチュートリアルを参照できます。

于 2013-03-28T16:01:00.520 に答える