Wednesday, 13 March 2013

Android Notification Manager

// notification is selected
        Intent intent = new Intent(this, HotelListTable.class);
        PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);

        // Build notification
        // Actions are just fake
        Notification noti = new Notification.Builder(this)
            .setContentTitle("New mail from " + "test@gmail.com")
            .setContentText("Subject").setSmallIcon(R.drawable.hotel)
            .setContentIntent(pIntent)
            .addAction(R.drawable.hotel, "Call", pIntent)
            .addAction(R.drawable.hotel, "More", pIntent)
            .addAction(R.drawable.hotel, "And more", pIntent).build();
        NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        // Hide the notification after its selected
        noti.flags |= Notification.FLAG_AUTO_CANCEL;

        notificationManager.notify(0, noti);

1 comment:

  1. Casino, Sportsbook, Live Betting - DrmCD
    Get up-to-date odds and information for all your favourite 구리 출장마사지 sports 사천 출장안마 and games. Get up 진주 출장마사지 to date 전라북도 출장안마 odds, live betting results, mobile app & 논산 출장안마 live streaming

    ReplyDelete