Interface IPushDeviceState
- All Known Implementing Classes:
PushDeviceStateImpl
public interface IPushDeviceState
What one device can do for Push Notification right now, as the client reports it.
Decided on the device by feature detection, never by browser or version sniffing (ruling R2): a Browser supports Push Notification when it has the Notification API, a Service Worker registration and the Push API, all three; a Cordova app when the FirebaseX plugin is present.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionGets the device UUID, theX-iiziheader of the PN HTTP API.Gets the notification permission.Gets the transport this device would be reached through.booleanChecks whether the device holds a subscription for this application that this server also holds.
Method Details
getDeviceUUID
String getDeviceUUID()Gets the device UUID, theX-iiziheader of the PN HTTP API.- Returns:
- The canonical 36-character UUID, never
null.
getPermission
PushPermission getPermission()Gets the notification permission.- Returns:
- The permission, never
null;PushPermission.UNSUPPORTEDwhen the device cannot receive Push Notification at all.
getTransport
PushTransport getTransport()Gets the transport this device would be reached through.- Returns:
PushTransport.VAPIDfor a Browser,PushTransport.FCMfor a Cordova app, ornullwhen the device isPushPermission.UNSUPPORTED.
isSubscribed
boolean isSubscribed()Checks whether the device holds a subscription for this application that this server also holds. A device subscription the server does not know, or a stored row whose device has lost its subscription, is not subscribed.- Returns:
truewhen both ends hold the subscription.