Open Phone, SMS, Email, Skype and Browser apps of Android in Unity3d
最近项目需要使用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://stackoverflow.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);
Open Phone, SMS, Email, Skype and Browser apps of Android in Unity3d的更多相关文章
- Sample Apps by Android Team -- Amazed
Sample Apps by Android Team 代码下载:http://pan.baidu.com/s/1eSNmdUE , 代码原地址:https://code.google.com/arc ...
- Android测试:Testing Apps on Android
原文:https://developer.android.com/training/testing/index.html 测试你的App是开发过程中的重要组成部分.通过对应用程序持续的运行测试,你可以 ...
- Tech Stuff - Mobile Browser ID (User-Agent) Strings
Tech Stuff - Mobile Browser ID (User-Agent) Strings The non-mobile stuff is here (hint: you get jerk ...
- [WebView其中一项研究]:Web Apps基本介绍
今天,我们开始了解WebView,以及Web Apps发展,从主要内容Android实际的例子来解释正式文件和后续. (博客地址:http://blog.csdn.net/developer_jian ...
- 设置默认Browser
电信A库要求android系统中有多个Browser时,开机自动设置一个默认浏览器,而不用弹出选择框让用户手动选择. 监听开机广播Intent.ACTION_BOOT_COMPLETED, 用Pack ...
- Android 4.4 (KitKat) SMS Apis Change——Android 4.4的一个重大变化
Android团队通过Android开发博客透漏今年会放出Android 4.4 (KitKat) ,同时更新了 SMS 的部分API.博客上讲只有default SMS app才能对短信数据库有写权 ...
- Browser默认书签加载过程
Browser配置默认书签——string.xml中<string-array name="bookmarks" translatable="false" ...
- Browser设置搜索引擎
Browser设置搜索引擎,在com.android.browser.preferences.GeneralPreferencesFragment中加载R.xml.general_preference ...
- javascript: detect mobile devices or browser
http://detectmobilebrowsers.com/ http://hgoebl.github.io/mobile-detect.js/ http://www.hand-interacti ...
随机推荐
- XForms标准介绍
XForms标准是真正实现展现与模型分离的.与客户端无关的展现服务标准. 1.XForms标准 XForms是W3C组织所推荐的下一代在线展现服务标准(早在2003年10月14日就被W3C推荐),它吸 ...
- DFS入门之一
深度优先搜索实现较为简单,需要控制两个因素: 1.已经访问过的元素不能再访问,在实际题目中还要加上不能访问的元素(障碍) 2.越界这种情况是不允许的 以杭电的1312 Red and Black 为例 ...
- CentOS6.4下使用默认的PDF文档阅读器出现乱码的解决方案
方法一:修改/etc/fonts/conf.d/49-sansserif.conf文件,如下: 1: <?xml version="1.0"?> 2: <!DOC ...
- 创建本地Ubuntu镜像
参考文档 http://www.howtoforge.com/local_debian_ubuntu_mirror 安装服务 : sudo apt-get install apt-mirror apa ...
- module graceful-fs for npm
问题: 今天使用hexo时发现错误,hexo:command not found.于是重新安装hexo.但是在安装好npm后,却发现运行 npm 出现错误,没有找到模块graceful-fs,在纠结了 ...
- Less 导入命令 @import
在这个less文件上想导入另一个less文件, 连在同级的文件里直接可用文件名 @import url('css.less')或@import rul(css) 连下级的文件 @import url( ...
- Entity Framework 并发处理借鉴
如下博客 http://www.cnblogs.com/Bce-/p/3725868.html
- 关于Protobuf在游戏开发中的运用
最近在研究protobuf在项目中的使用,由于我们项目服务端采用的是C++,客户端是cocos2dx-cpp,客户端与服务端的消息传输是直接对象的二进制流.如果客户端一直用C++来写,问题到不大,但是 ...
- php读取html并截取字符串
一般php采集代码能用的到,这里只是简单的实现代码. <?php $title='脚本学堂'; $hello='jbxue.com!'; $file=file_get_contents('htt ...
- 【Delphi】最小化事件捕捉
添加一个ApplicationEvents组件在窗体,然后处理其OnMinimize事件和OnRestore事件即可.