Package zendesk.core
Interface PushRegistrationProvider
-
public interface PushRegistrationProvider
A provider which will offer a higher level of abstraction compared to the
PushRegistrationService
You can create an instance of PushRegistrationProvider like this:
import zendesk.core.PushRegistrationProvider; import zendesk.core.Zendesk; ... PushRegistrationProvider provider = Zendesk.INSTANCE.provider().pushRegistrationProvider(); ...
Once you have an instance of the provider you can call methods on it and handle the results in callbacks. A success callback will give you the resource(s) that you are requesting, like the result of registering for and un-registering from push. The error callback will be called if there was some issue with the method call and it will define details about the error in an
ErrorResponse
For example you can register the device for push notifications like this:
provider.registerWithDeviceIdentifier("push-token", Locale.getDefault(), new ZendeskCallback<PushRegistrationResponse>() { @Override public void onSuccess(String pushRegistrationIdentifier) { // Handle success } @Override public void onError(ErrorResponse errorResponse) { // Handle error } });
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description boolean
isRegisteredForPush()
Returns whether or not the device is currently registered for push notifications.void
registerWithDeviceIdentifier(java.lang.String identifier, <any> callback)
Calls a push registration service to register a given identifier to receive push notifications.void
registerWithUAChannelId(java.lang.String urbanAirshipChannelId, <any> callback)
Calls a push registration service to register a given Urban Airship channel id to receive push notifications.void
unregisterDevice(<any> callback)
Calls a push registration service to unregister a device to receive push notifications.
-
-
-
Method Detail
-
registerWithDeviceIdentifier
void registerWithDeviceIdentifier(java.lang.String identifier, <any> callback)
Calls a push registration service to register a given identifier to receive push notifications.- Parameters:
identifier
- The device identifiercallback
- Callback that will deliver a newly created device configuration pushRegistrationIdentifier orErrorResponse
-
registerWithUAChannelId
void registerWithUAChannelId(java.lang.String urbanAirshipChannelId, <any> callback)
Calls a push registration service to register a given Urban Airship channel id to receive push notifications.- Parameters:
urbanAirshipChannelId
- The UrbanAirship channel identifiercallback
- Callback that will deliver a newly created device configuration pushRegistrationIdentifier orErrorResponse
-
unregisterDevice
void unregisterDevice(<any> callback)
Calls a push registration service to unregister a device to receive push notifications.- Parameters:
callback
- Callback that will deliver aVoid
orErrorResponse
-
isRegisteredForPush
boolean isRegisteredForPush()
Returns whether or not the device is currently registered for push notifications.- Returns:
- true if this device is currently registered for push notifications, false if not.
-
-