APIレベル11以上はNotificationクラスのBuilderが使えますが
11未満は使えませんのでNotificationのコンストラクタで作成することになります。
あと、Builderのメソッドも16以上では非推奨なものがあるのでそこも振り分けが必要です。
動画確認してませんがこんな感じになると思います。
`
public static void setNotification(Context context, String title, String message, PendingIntent contentIntent){
Notification notification;
if(android.os.Build.VERSION.SDK_INT > 10){
Notification.Builder mBuilder = new Notification.Builder(context)
.setContentIntent(contentIntent).setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(title)
.setTicker(message)
.setContentText(message)
.setWhen(System.currentTimeMillis());
notification = android.os.Build.VERSION.SDK_INT > 15 ? mBuilder.build() : mBuilder.getNotification();
}else{
notification = new Notification(R.drawable.ic_launcher, message, System.currentTimeMillis());
notification.setLatestEventInfo(context, title, message, contentIntent);
}
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(R.string.app_id, notification);
}
`
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2014/07/23 08:05
2014/07/23 08:10
退会済みユーザー
2014/07/23 08:21
2014/07/23 08:34
退会済みユーザー
2014/07/24 05:41
2014/07/24 05:51