use of android.app.Notification in project cw-advandroid by commonsguy.
the class NoticeReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
NotificationManager mgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification note = new Notification(R.drawable.stat_notify_chat, "Yoo-hoo! Wake up!", System.currentTimeMillis());
PendingIntent i = PendingIntent.getActivity(context, 0, new Intent(context, OrderedActivity.class), 0);
note.setLatestEventInfo(context, "You Care About This!", "...but not enough to keep the activity running", i);
mgr.notify(NOTIFY_ME_ID, note);
}
use of android.app.Notification in project Android-ReactiveLocation by mcharmas.
the class GeofenceBroadcastReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
GeofencingEvent event = GeofencingEvent.fromIntent(intent);
String transition = mapTransition(event.getGeofenceTransition());
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_launcher).setContentTitle("Geofence action").setContentText(transition).setTicker("Geofence action").build();
nm.notify(0, notification);
}
use of android.app.Notification in project AndroidTraining by mixi-inc.
the class NotificationActivity1 method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification1);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
Notification notification = builder.setSmallIcon(R.drawable.ic_launcher).setContentTitle("通知テスト").setContentText("通知の詳細テスト").setTicker("通知ティッカーテスト").setVibrate(// 3秒間バイブレーションが作動
new long[] { 3000 }).build();
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, notification);
}
use of android.app.Notification in project AndroidTraining by mixi-inc.
the class NotificationActivity2 method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification2);
Intent intent = new Intent();
intent.setAction(ACTION_VIEW_MY_OWN);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
Notification notification = builder.setSmallIcon(R.drawable.ic_launcher).setContentTitle("通知テスト").setContentText("通知の詳細テスト").setContentIntent(pendingIntent).build();
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, notification);
}
use of android.app.Notification in project AndroidTraining by mixi-inc.
the class NotificationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification);
Intent intent = new Intent(this, NotificationSubActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
Notification notification = builder.setSmallIcon(R.drawable.ic_launcher).setContentTitle("通知テスト").setContentText("通知の詳細テスト").setContentIntent(// 通知をタップした時に使う PendingIntent
pendingIntent).setOnlyAlertOnce(// この通知が未だ表示されていない時だけ、音やバイブレーション、ショートメッセージの表示を行う
true).setAutoCancel(// タップしたら消えるようにする
true).build();
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, notification);
}
Aggregations