Package org.mozilla.geckoview
Interface WebPushDelegate
public interface WebPushDelegate
-
Method Summary
Modifier and TypeMethodDescriptiondefault GeckoResult<WebPushSubscription>
onGetSubscription
(String scope) Retrieves a subscription for the given service worker scope.default GeckoResult<WebPushSubscription>
onSubscribe
(String scope, byte[] appServerKey) Creates a push subscription for the given service worker scope.default GeckoResult<Void>
onUnsubscribe
(String scope) Removes a push subscription.
-
Method Details
-
onSubscribe
@UiThread @Nullable default GeckoResult<WebPushSubscription> onSubscribe(@NonNull String scope, @Nullable byte[] appServerKey) Creates a push subscription for the given service worker scope. A scope uniquely identifies a service worker. `appServerKey` optionally creates a restricted subscription.Applications will likely want to persist the returned
WebPushSubscription
in order to supportonGetSubscription(String)
.- Parameters:
scope
- The Service Worker scope.appServerKey
- An optional application server key.- Returns:
- A
GeckoResult
which resolves to aWebPushSubscription
- See Also:
-
onGetSubscription
@UiThread @Nullable default GeckoResult<WebPushSubscription> onGetSubscription(@NonNull String scope) Retrieves a subscription for the given service worker scope.- Parameters:
scope
- The scope for the requestedWebPushSubscription
.- Returns:
- A
GeckoResult
which resolves to aWebPushSubscription
- See Also:
-
onUnsubscribe
Removes a push subscription. If this fails, apps should resolve the returnedGeckoResult
with an exception.- Parameters:
scope
- The Service Worker scope for the subscription.- Returns:
- A
GeckoResult
, which if non-exceptional indicates successfully unsubscribing. - See Also:
-