「android入門」NotificationCompat.Builderを使ってレイアウトをカスタムする

1.Android 4.0以上
RemoteViews rvMain = new RemoteViews(context.getPackageName(), R.layout.notification_layout);
//TODO rvMain…
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setContent(rvMain);
// TOOD …

2.Android 2.3
RemoteViews rvMain = new RemoteViews(context.getPackageName(), R.layout.notification_layout);
//TODO rmMain…
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setContent(rvMain);
// TOOD …
Notification notification = builder.build();
if(Build.VERSION.SDK_INT <= 10){
notification.contentView = rvMain;
}

3.ステータスバー通知
setContentIntent()://通知トリガ
setFullScreenIntent()://通知表示する場合呼び出

Android

Posted by arkgame