Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
109 stars 139 forks source link

How can I know if the Device was registered successfully, and Get pushToken function should have a callback error #228

Closed ignacio-chiazzo closed 7 years ago

ignacio-chiazzo commented 7 years ago

First of all, I would like to have a mechanism to see if the device was registered successfully, I only found two solutions. The first one is with the function getPushToken, the second one is with the function listDevices and then see if my device is on the list (not nice solution :/).

Related to the first solution I found the following issue :

getPushToken && getPushwooshHWID should be functions that have the two types of callbacks (success and error). In the case that the token is not registered or something happened

- (void)getPushToken:(CDVInvokedUrlCommand *)command { NSString *token = [[PushNotificationManager pushManager] getPushToken]; CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:token]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; }

Let me know if there is another way to check if the device was registered successfully, or any update of those two functions

NOTE: I want to know if the device is registered after the device (too much later) was registered.

wfhm commented 7 years ago

Hi,

You can use getPushToken for this purpose - it returns a stored token value for a device; if a returned value is null or "" then a device is not registered, otherwise a token will be returned.

Does this functionality cover your needs?