开发者

Android Notification not workng

i have the following code. Problem is, when i click on the notification bar (when app launched i see the Text inside: By Firstdroid.com text, but nothing else, even if i click on the bar.

  NotificationManager mNotManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    String MyText = "Text inside: By Firstdroid.com";
    Notification mNotification = new Notification(
           R.drawable.icon,                // An Icon to display
           MyText,                         // the text to display in the ticker
           System.currentTimeMillis()       ); // the time for the notification
    mNotification.defaults |= Notification.DEFAULT_SOUND;
    String MyNotifyTitle = "Firstdroid Rocks!!!";
    String MyNotifiyText  = "Firstdroid: our forum at www.firstdroid.com";
    Intent MyIntent = new Intent( getApplicationContext(), HelloAndroid2.class );

    MyIntent.putExtra("extendedTitle", MyNotifyTitle);
    MyIntent.putExtra("extendedText" , MyNotifiyText);
    PendingIntent StartInt开发者_开发问答ent = PendingIntent.getActivity(getApplicationContext(),0,MyIntent,PendingIntent.FLAG_CANCEL_CURRENT);

    mNotification.setLatestEventInfo(   getApplicationContext(),
            MyNotifyTitle,
            MyNotifiyText,
            StartIntent);

    /* Sent Notification to notification bar */
    mNotManager.notify(  SIMPLE_NOTIFICATION_ID , mNotification );  


I am writing this to close this question.

Copied from my comment before: I solved it. There was no problem, i just didn't know that i had had to pull the notification down instead of clicking the green notepad-like button

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜