こんにちは、特定の時間にユーザーに通知を送信する必要があるアプリを開発しようとしています。インターネットでこのコードを見つけましたが、Eclipse は非推奨であると言っています。私のAPIでそれを行う適切な方法はどれですか? (16)
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
int icon = R.drawable.worldmap2;
CharSequence tickerText = "Hello";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText,when);
Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
final Intent intent1 = new Intent(context, HttpExampleLimits.class);
PendingIntent pIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent1, 0);
notification.setLatestEventInfo(context, contentTitle,contentText, pIntent);
nm.notify(1, notification);
どうもありがとうございました!