0
A
答えて
0
次のコードを追加することができます
public void createNotification() {
// Prepare intent which is triggered if the
// notification is selected
Intent intent = new Intent(this, NotificationReceiverActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent, 0);
// Build notification
// Actions are just fake
Notification noti = new Notification.Builder(this)
.setContentTitle("New mail from " + "[email protected]")
.setContentText("Subject").setSmallIcon(R.drawable.icon)
.setContentIntent(pIntent)
.addAction(R.drawable.delete, "Delete", pIntent)
.addAction(R.drawable.reply, "reply", pIntent)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// hide the notification after its selected
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, noti);
}
+0
このaddActionメソッドは、アンドロイド22以上で使用できますが、これを古いバージョンでどのように処理できますか? @Avinash –
+0
通知の代わりにNotificationCompat.Builderを試すことができます – Avinash
関連する問題
- 1. プッシュ通知アクションボタン
- 2. Appleプッシュ通知アクションボタン
- 3. プッシュ通知の設定アクションボタン
- 4. コルドバAndroidのプッシュ通知アクションボタン
- 5. 通知なしのアクションボタン - Wear
- 6. didFinishLaunchingWithOptionは、プッシュ通知のアクションボタンが
- 7. Android通知のアクションボタンの位置
- 8. 通知のアクションボタンにonClickListenerを設定する
- 9. 通知にアクションボタンが表示されないiOS 10
- 10. アンドロイド通知でアクションボタンが表示されない
- 11. イオン2プッシュ通知アクションボタンtypecriptを使用してコールバックをクリック
- 12. iOS 10ローカル通知のアクションボタンを表示できません
- 13. Android - 通知アクションボタンからメソッドを呼び出す
- 14. アクションボタンをiOS10通知に常に表示することはできますか?
- 15. は、アクションの現在の通知を閉じ、私はアクションボタンとカスタム通知を持って
- 16. Facebookの告知メールによる通知
- 17. PHPによるリアルタイム通知
- 18. WIAによるスキャン通知
- 19. Firebaseによるプッシュ通知
- 20. JenkinsfileによるJabber通知
- 21. 通知のアクションボタンのデフォルトの色とスタイルを取得するにはどうすればよいですか?
- 22. SignalR通知によるWeb API遅延によるAndroidプッシュ通知
- 23. Bluemixプッシュ通知サービスによるユーザベースの通知
- 24. 私のように定義された通知持っ通知
- 25. スクリーンキャプチャ通知のような通知を表示する方法
- 26. どのように表示するかを通知するヘッドアップ通知
- 27. PHPによるOpenfireのオフライン通知
- 28. JS通知のプログラムによるクリック
- 29. iOS AWS SNSによるプッシュ通知
- 30. PHPのプッシュプルメソッドによる即時通知
https://developer.android.com/guide/topics/ui/notifiers/notifications.html –
下記のリンク、HTTPSをチェック:/ /stackoverflow.com/questions/20748049/android-multiple-line-notification-like-gmail-app – codeWorm