Last active
August 29, 2015 14:05
-
-
Save rahulinaction/9337f8dd5618955d4762 to your computer and use it in GitHub Desktop.
PhoneDialer header file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <Cordova/CDVPlugin.h> | |
@interface PhoneDialer : CDVPlugin | |
- (void) dialPhone:(NSMutableArray *)arguments withDict:(NSMutableDictionary *) options; | |
@end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "PhoneDialer.h" | |
@implementation PhoneDialer | |
- (void) dialPhone:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { | |
NSString* ph = [options valueForKey:@"number"]; | |
UIDevice *device = [UIDevice currentDevice]; | |
if ([[device model] isEqualToString:@"iPhone"] ) { | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", ph]]]; | |
} else { | |
UIAlertView *Notpermitted=[[UIAlertView alloc] initWithTitle:@"Alert" message:@"Your device doesn't support this feature." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[Notpermitted show]; | |
[Notpermitted release]; /*Remove this if it is a ARC Project*/ | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment