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);
}
use of android.app.Notification in project k-9 by k9mail.
the class NewMailNotifications method createStackedNotification.
private void createStackedNotification(Account account, NotificationHolder holder) {
if (isPrivacyModeEnabled()) {
return;
}
Notification notification = wearNotifications.buildStackedNotification(account, holder);
int notificationId = holder.notificationId;
getNotificationManager().notify(notificationId, notification);
}
Aggregations