Similar question here: jQueryMobile, Phonegap and Device Token - iOS
The scenario is, I have this PhoneGap web based application, and the native iOS help me registered t
The previous answers are really great ways to solve this problem and they do it in a very formal fashion. However, if you want a quick and dirty method of solving the problem, you can simply do this:
at the bottom of didRegisterForRemoteNotificationsWithDeviceToken add
NSString* jsString = [NSString stringWithFormat:@"var deviceToken = \"%@\";", deviceToken];
[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
In your javascript
deviceId = (typeof deviceToken !== "undefined") ? deviceToken : null;