2013-03-20 3 views
0

Привет, я пытаюсь разработать приложение, которое должно отправить уведомление пользователю в определенное время. В Интернете я нашел этот код, но eclipse говорит, что он устарел. Вы знаете, что это правильный способ сделать это с помощью моего API? (16)Код состояния статусов Android устарел

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); 

спасибо!

ответ

Смежные вопросы