I\'m making an iOS app which can open Viber app and automatically call a person or go to chat window with the person. Is there any url scheme for Viber to do that such as:>
You could use this code to accomplish what you want:
NSString *phoneNumber = @"1112223333";
NSString * const viberScheme = @"viber://";
NSString * const tel = @"tel";
NSString * const chat = @"chat";
NSString *action = @""; // this could be @"chat" or @"tel" depending on the choice of the user
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:viberScheme]]) {
// viber is installed
NSString *myString;
if ([action isEqualToString:tel]) {
myString = [NSString stringWithFormat:@"%@:%@", tel, phoneNumber];
} else if ([action isEqualToString:chat]) {
myString = [NSString stringWithFormat:@"%@:%@", chat, phoneNumber];
}
NSURL *myUrl = [NSURL URLWithString:[viberScheme stringByAppendingString:myString]];
if ([[UIApplication sharedApplication] canOpenURL:myUrl]) {
[[UIApplication sharedApplication] openURL:myUrl];
} else {
// wrong parameters
}
} else {
// viber is not installed
}