Last active
December 20, 2015 08:09
-
-
Save tatuas/6098717 to your computer and use it in GitHub Desktop.
API Level 4以降からすべて用のNotificationをただ表示するサンプル。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.v4.app.NotificationCompat; | |
Notification notification = new NotificationCompat.Builder(this) | |
.setTicker("Ticker Title") | |
.setContentTitle("Content Title") | |
.setContentText("Notification content.") | |
.setSmallIcon(R.drawable.ic_launcher) | |
.build(); | |
notification.flags = Notification.FLAG_AUTO_CANCEL; | |
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); | |
notificationManager.notify(0, notification); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/questions/16123021/android-notification-builder-getnotification-vs-build
http://www.sakc.jp/blog/archives/21065