最近私はアプリを開発しましたが、AndroidスタジオではsetLatestEventInfo
メソッドがサポートされなくなりましたので、このメソッドをNotification.Builder
メソッドに変更しようとしました。しかし、私は苦労しているので、誰かが私にこのメソッドをNotification.Builder
メソッドに変更することをサポートして欲しいです。setLatestEventInfoメソッドを解決できません
String ns = Context.NOTIFICATION_SERVICE;
mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.ic_launcher;
CharSequence tickerText = "Fall Detector";
long when = System.currentTimeMillis();
notification = new Notification(icon, tickerText, when);
mContext = getApplicationContext();
CharSequence contentTitle = "Fall Detector";
CharSequence contentText = "Running";
Intent notificationIntent = new Intent(this,StartActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.setLatestEventInfo(mContext, contentTitle, contentText,
contentIntent);
mNotificationManager.notify(1, notification);
私は以下を試しましたが、シンボルの内容が解決できないと言います。
String ns = Context.NOTIFICATION_SERVICE;
int icon = R.drawable.ic_launcher;
CharSequence tickerText = "Fall Detector";
long when = System.currentTimeMillis();
notification = new Notification(icon, tickerText, when);
mNotificationManager = (NotificationManager) getSystemService(ns);
Notification.Builder builder = new Notification.Builder(mContext)
.setContentTitle("Fall Detector")
.setContentText("Running")
.setContentIntent(contentIntent);
builder.build();
Notification notification = builder.getNotification();
mNotificationManager.notify(1, notification);
"私は苦労しています" - あなたの質問を編集して、あなたが試したこととあなたが遭遇した特定の問題を示してください。 [この1つ](https://stackoverflow.com/q/32345768/115145)のような、このトピックに関する文字通り何十という既存の質問があります。あなたの質問を重複としてマークしたくない人は、**あなたの質問を既存のものとは異なるものにするために**詳細に**説明する必要があります。 – CommonsWare
質問が更新されました –
私はコードを修正しましたが、symbol contentintentを解決できないという同じメッセージが表示されています。 –