Я не khow, как вы сделаете свое уведомление, но я думаю, вы должны использовать: System.currentTimeMillis()
Пример:
package com.test;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
public class TestActivity extends Activity {
private NotificationManager notificationManager;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
showNotification("My notification",android.R.id.text1);
}
private void showNotification(CharSequence text, int idNotify) {
Notification notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
Intent intent = new Intent();
intent.setClassName("com.test","com.test.TestActivity");
PendingIntent contentIntent = PendingIntent.getActivity(TestActivity.this, 0,intent,0);
notification.setLatestEventInfo(this, "My Notification",text, contentIntent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(idNotify, notification);
}
}
Спасибо! Я умножил currentTimeMillis() на 1000. Это была проблема! – Bernd
Тогда вы должны принять ответ :) – Fildor
Теперь я принял его :-) Не знал, как это сделать, так как я здесь новый. – Bernd