Skip to content

Commit

Permalink
Provide method to open native ios app settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivek Tiwari authored and Vivek Tiwari committed Jun 30, 2015
1 parent 37eca82 commit bb3327b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ - (void)isEnabled:(CDVInvokedUrlCommand*)command {
[self successWithMessage:jsStatement];
}

- (void)openSettings:(CDVInvokedUrlCommand*)command {
BOOL canOpenSettings = (&UIApplicationOpenSettingsURLString != NULL);
if (canOpenSettings) {
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
}
}


- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

Expand Down
16 changes: 16 additions & 0 deletions www/PushNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ PushNotification.prototype.isEnabled = function(successCallback, errorCallback){
cordova.exec(successCallback, errorCallback, "PushPlugin", "isEnabled", []);
};


//To open ios app settings
PushNotification.prototype.openSettings = function(successCallback, errorCallback){
if (errorCallback == null) { errorCallback = function() {}}

if (typeof errorCallback != "function") {
console.log("PushNotification.openSettings failure: failure parameter not a function");
return
}
if (typeof successCallback != "function") {
console.log("PushNotification.openSettings failure: success callback parameter must be a function");
return
}
cordova.exec(successCallback, errorCallback, "PushPlugin", "openSettings", []);
};

//-------------------------------------------------------------------

if(!window.plugins) {
Expand Down

0 comments on commit bb3327b

Please sign in to comment.