最近项目需要使用Android的一些基本功能,写插件各种悲剧,google了一下,如获至宝。Nice !
string url = String.Format("tel:{0}",phoneNumber); string url = String.Format("sms:{0}?body={1}", numbers, message); string url = String.Format("mailto:{0}?subject={1}&body={2}",email_address,subject,body); Application.OpenURL(url);
相关引用:
http://www.makebetterthings.com/iphone/open-phone-sms-email-map-and-browser-apps-in-iphone-sdk/
Here is how you can open default Phone app, SMS app, Email app, Maps app and browser app with openURL.
Open default Phone app in iPhone:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]]; Open default SMS app in iPhone:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]]; Open default Email app in iPhone:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://devprograms@apple.com"]];
这里注意几点,如果写Android min sdk 如果低的话他会默认继承ActionBarActivity类 ,而不是Activity。
同时会产生一个 appcompont工程来让低版本的库来兼容运行actionbar特性。
如果unity3d 的 子Activity 继承ActionBarActivity而不是Activity会无法启动。
// 此外 最好min sdk 是4.0 ,max sdk 也是4.0
// 因为 minsdk 低于4.0,max sdk 高于 4.0 会丢失一个主题,需要自己 手动导入
2014-9-4 Add Lauch Skype
应用除了tel 进行联系之外 ,还需要 Lauch Skype
googl之
SkyPe官网 有这么一段代码
http://msdn.microsoft.com/en-us/library/office/dn745882(v=office.15).aspx#video
http://msdn.microsoft.com/en-us/library/office/dn745884(v=office.15).aspx
/**
* Initiate the actions encoded in the specified URI.
*/
public void initiateSkypeUri(Context myContext, String mySkypeUri) { // Make sure the Skype for Android client is installed.
if (!isSkypeClientInstalled(myContext)) {
goToMarket(myContext);
return;
} // Create the Intent from our Skype URI.
Uri skypeUri = Uri.parse(mySkypeUri);
Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); // Restrict the Intent to being handled by the Skype for Android client only.
myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Initiate the Intent. It should never fail because you've already established the
// presence of its handler (although there is an extremely minute window where that
// handler can go away).
myContext.startActivity(myIntent); return;
}
实际应用了一下,发现启动不了,也不知道为什么,但是内存是启动了,只是focus没有转到skype上面。
悲剧,继续google,
http://*.com/questions/10132556/how-to-start-a-skype-call-from-an-android-app
发现很多办法都大同小异,基本上都是官网的盘版。
偶然之下试了下这个办法,成功启动
http://blog.csdn.net/fhy_2008/article/details/6694219
PackageManager packageManager = getPackageManager();
Intent skype = packageManager.getLaunchIntentForPackage("com.skype.raider");
skype.setData(Uri.parse("tel:65465446"));//Uri.parse("skype:" + UserName + "?call")
startActivity(skype);