Android, send push notification to myself -
i want user send force notification himself.
is there way without using google cloud messaging?
it offline, show notification on own phone.
thanks.
example building , sending notification:
from: http://www.vogella.com/tutorials/androidnotifications/article.html
// prepare intent triggered if // notification selected intent intent = new intent(this, notificationreceiver.class); pendingintent pintent = pendingintent.getactivity(this, 0, intent, 0); // build notification // addaction re-use same intent maintain illustration short notification n = new notification.builder(this) .setcontenttitle("new mail service " + "test@gmail.com") .setcontenttext("subject") .setsmallicon(r.drawable.icon) .setcontentintent(pintent) .setautocancel(true) .addaction(r.drawable.icon, "call", pintent) .addaction(r.drawable.icon, "more", pintent) .addaction(r.drawable.icon, "and more", pintent).build(); notificationmanager notificationmanager = (notificationmanager) getsystemservice(notification_service); notificationmanager.notify(0, n);
you can edit notification like.
also helpful:
http://developer.android.com/training/notify-user/build-notification.html
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
http://developer.android.com/reference/android/app/notificationmanager.html
http://developer.android.com/reference/android/support/v4/app/notificationcompat.builder.html
happy coding...
android push-notification
No comments:
Post a Comment