开发者

How to launch "Google Translate" app?

开发者 https://www.devze.com 2023-03-06 11:57 出处:网络
I would like to launch \"Google Translate\" applicatio开发者_开发百科n when user taps a button in my app.

I would like to launch "Google Translate" applicatio开发者_开发百科n when user taps a button in my app.

is it possible?

Thank you.


I don't know what url scheme supported by the google translate app but you can open the iTranslate app using this -

To launch the application:

NSString *stringURL = @"itranslate://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

To translate a text:

NSString *textToTranslate = @"Hello world"; // Text must be URL-encoded...!
textToTranslate = [textToTranslate stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *test =  [NSString stringWithFormat:@"itranslate://translate?from=en&to=de&text=%@",textToTranslate];
NSURL *url = [[NSURL alloc] initWithString:test];
[[UIApplication sharedApplication] openURL:url];

also have a look on this - http://wiki.akosma.com/IPhone_URL_Schemes


The url scheme for google translate is googletranslate://

0

精彩评论

暂无评论...
验证码 换一张
取 消