2
私は、ユーザーのやりとり中にそこに残っているステータスバーにカスタム通知をしたいだけです。唯一のAndroidスマートフォンで4Andorid:ステータスバーに消去不可能なカスタム通知を作成する方法は?
Notification notification = new Notification(getBatteryStateResource(percent,status), "notify",System.currentTimeMillis());
notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
notification.contentView = new RemoteViews(mContext.getPackageName(), R.layout.statusbar);
Intent intent = new Intent(mContext, Activity.class);
PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
notification.contentIntent=contentIntent;
notification.contentView.setOnClickPendingIntent(R.id.imageView, anotherContentIntent);
NotificationManager nm = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(42, notification);
このコード作業:
私はこのコードを使用します。タブレットでは、通知のimageViewをクリックするたびに、システム削除通知が表示されます。
代わりに、Android 2.3と2.2では「anotherContentIntent」は開始せず、「contentIntent」のみを開始します。なぜですか?
多くのおかげで、すべての.... FLAG_ONGOING_EVENT
に加えて
多くのおかげで.... – Meroelyth