How to handle NotificationBar in android -
i tried code form reply of question: how set media controller button on notification bar?
by calling
shownotification()
method app gets closed. how prevent this? , how can handle method called if mobile phone api >= 16. because think available since api 16.
i've read, there solution lower api:
import android.support.v4.app.notificationcompat;
but didn't got working, wanted prevent calling it.
and can delete notification bar, ondestroy() of app?
the code on page hard case using remoteviews
, , looks dubious anyway. (e.g. creates subclass of notification
constructor creates notification
.)
the normal approach utilize notificationcompat.builder
build notification, , notificationmanager
or notificationmanagercompat
show , cancel it. see notifications api guide details , illustration code.
also see notifying user documentation , notifications design guide.
generally, app should show notification when activity not visible. when user taps on notification, should open activity should in turn cancel notification.
android android-notifications android-notification-bar
No comments:
Post a Comment