Я пытаюсь создать уведомление в Android. Иконка не отображается, а текст исчезает. Также, когда вы нажимаете на нее, Intent не вызывается. (У меня есть тестовое намерение, которое должно вызвать веб-браузер).
Я не могу понять, почему текст исчезает, и когда я нажимаю на панель состояния, браузер не появляется.
код
public class Welcome extends Activity
{
private NotificationManager mNotificationManager;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mNotificationManager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
Notification notifyDetails = new Notification(
R.drawable.icon, "Click Me!", System.currentTimeMillis());
Context context = getApplicationContext();
CharSequence contentTitle = "Notification Details...";
CharSequence contentText = "Ted";
Intent notifyIntent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://www.android.com"));
PendingIntent intent = PendingIntent.getActivity(this, 0, notifyIntent,
android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle,
contentText, intent);
mNotificationManager.notify(1, notifyDetails);
}
}
Тед