Permalink
Browse files

Merge pull request #27 from gusennan/master

PhoneGap 2.3 returns "iOS" for device.platform, not iPad/iPhone/iPod.
  • Loading branch information...
2 parents 016b1e8 + af2c8f1 commit 454a0285656e01e3af60e53480778714a3949470 @jtowle jtowle committed Mar 6, 2013
Showing with 17 additions and 8 deletions.
  1. +15 −6 README.md
  2. +2 −2 ios-sample/www/lib/PushNotification.js
View
@@ -12,8 +12,12 @@ For a more complete example, check out the sample app [index.html](https://githu
// Callback for when a device has registered with Urban Airship.
// https://docs.urbanairship.com/display/DOCS/Server%3A+Android+Push+API#ServerAndroidPushAPI-Registration
- push.registerEvent('registration', function (id) {
- console.log("Registered with ID: " + id);
+ push.registerEvent('registration', function (error, id) {
+ if (error) {
+ console.log('there was an error registering for push notifications');
+ } else {
+ console.log("Registered with ID: " + id);
+ }
});
// Callback for when the app is running, and recieves a push.
@@ -284,10 +288,15 @@ This event is trigerred when your application is open, and a push comes in.
## Registration
-*Callback arguments:* (String id)
+*Callback arguments:* (Boolean error, String id)
This event is trigerred when your application recieves a registration response from Urban Airship.
- push.registerEvent('registration', function (id) {
- console.log("Registered with ID: " + id);
- };
+ push.registerEvent('registration', function (error, id) {
+ if (error) {
+ console.log('there was an error registering for push notifications');
+ } else {
+ console.log("Registered with ID: " + id);
+ }
+ });
+
@@ -87,15 +87,15 @@ PushNotification.prototype.call_native = function (callback, name, args) {
}
PushNotification.prototype.isPlatformIOS = function () {
- return device.platform == "iPhone" || device.platform == "iPad" || device.platform == "iPod touch"
+ return device.platform == "iPhone" || device.platform == "iPad" || device.platform == "iPod touch" || device.platform == "iOS"
}
// Core API
// Registration
PushNotification.prototype.registerForNotificationTypes = function (types, callback) {
- if(device.platform == "iPhone" || device.platform == "iPad" || device.platform == "iPod touch") {
+ if(device.platform == "iPhone" || device.platform == "iPad" || device.platform == "iPod touch" || device.platform == "iOS") {
this.call_native(callback, "registerForNotificationTypes", [types])
}
}

0 comments on commit 454a028

Please sign in to comment.