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.
How can i implement notification like this?
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.
How can i implement notification like this?
まず第一に、機能ボタンをNotification
実行中のデバイスHoneycomb
またはそれ以降のデバイスに追加できます。はい、一部の以前のHoneycomb
デバイスにはそのような種類がありますがNotifications
、そのようなものを作成できたのはデバイス メーカーだけです (またはNotifications
の例)。Dialer
Music Player
このような通知を使用するには、customView
for を使用できますNotification
( を参照してくださいRemoteViews
)。
より簡単な方法 (および推奨される方法) は、メソッドを使用NotificationCompat.Builder
して使用することです。このaddAction
メソッドは、ボタンがクリックされたときに、指定したボタンを追加してNotification
実行しPendingIntent
ます。これは以前のHoneycomb
デバイスでも機能します。つまり、古いデバイスではボタンが表示されません。
編集: Vogella : Android Notificationsのこの素晴らしいチュートリアルを参照できます。