Android根据Uri跳转Skype会话页面
产品增加了一个需求:根据Skype邀请会话链接,跳转到Skype的会话页面。官方未给出相关的解决方案,根据搜索到的资料最后实现了该功能。记录一下摸索的过程:
方案一:根据包名直接跳转(微软官方给的方案)
/*** 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;
}
官方给的方案,测试未能实现。我下载的apk,包名其实是”com.skype.rover",改为实际包名也失败。
方案二:根据tel格式的intent跳转
Intent intent = new Intent("android.intent.action.CALL_PRIVILEGED");
intent.setClassName("com.skype.raider", "com.skype.raider.Main");
intent.setData(Uri.parse("tel:" + phone));
startActivity(intent);
这种方案也失败!
方案三:根据LaunchIntentForPackage
Intent intent = getPackageManager().getLaunchIntentForPackage("com.skype.rover");
if (intent == null) {intent = getPackageManager().getLaunchIntentForPackage("com.skype.raider");
}
intent.setData(Uri.parse("ms-sfb://chat?id=live:.cid.2836abbxxzd54346"));
startActivity(intent);
此方案只能启动Skype,并不能进入聊天页面
方案四:skype:// 这个scheme来启动Skype
点击Skype邀请链接,会出现加入会话的按钮,拦截此时的url,会得到启动的scheme及详细参数,根据此scheme就能成功跳转到对应的聊天页面
public boolean shouldOverrideUrlLoading(WebView view, String url) {if (url.contains("scheme=skype")) {Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("skype://live:.cid.45fea242a00032e5?chat&correlationId=b4b43d94-9836-4fae-a28c-5d5a2de87320&utm_source=buddy&utm_content=yX4Y9UC4444B&origin=launcher#Intent;scheme=skype;S.browser_fallback_url=https%3A%2F%2Fgo.skype.com%2Fspaces.getskype;end;"));startActivity(intent);} else {view.loadUrl(url);}return true;}
这里的Uri是修改过的,原始的url是以intent://开头的,需要改成skype。这样就完成了跳转到Skype聊天页面的功能。(这里Skype账号是固定的,也可以截取url中“intent://"后的内容)。
参考链接:
Skype URI tutorial - Android apps | Microsoft Docs
Android Skype Intent - Stack Overflow
Android开发中常用的Intent跳转_PLS的专栏-程序员宅基地 - 程序员宅基地
Html a标签实现点击调用mail,skype,whatsapp,qq等应用进行聊天,拨号,发送邮件-Web前端-萝卜网络博客
Android根据Uri跳转Skype会话页面相关推荐
- 在没有个人/公司网站的情况下,如何利用同一个二维码自动识别手机系统(Android/IOS)跳转不同下载页面
一.使用场景 开发了一款App,包括iOS及Android版,到了推广阶段,准备生成二维码让用户扫码下载,那这个二维码该怎么生成?iOS及Andorid各自生成一个二维码让用户区分下载?当然这种方式是 ...
- 点击android搜索框跳入另一个页面,android - ToolBar中的SearchView如何让点击之后跳转到一个新的Activity...
PHP中文网2017-04-17 13:08:302楼 @李引证 的回答包括了关键信息,我来补充一些细节,及纠正几个细节上的错误. 关于"菜单项的点击事件" 我们需要覆写 onCr ...
- 【Google Play】从 Android 应用中跳转到 Google Play 中 ( 跳转代码示例 | Google Play 页面的链接格式 | Google Play 免安装体验 )
文章目录 前言 一.从 Android 应用跳转到 Google Play 代码 二.Google Play 页面的链接格式 三.Google Play 免安装体验 前言 本博客参考资料 链接到 Go ...
- android动态添加的页面怎么加功能_Android跳转应用安装页面
一.低版本跳转方式 Intent intent = new Intent(Intent.ACTION_VIEW);intent.setDataAndType(uri,"application ...
- android 获取单个通讯录联系人信息(无权限跳转权限设置页面)
首先说一下,在魅族手机上需要用户手动开启权限,不然获取到的cursor.moveToFirst()会返回false,反过来,如果cursor.moveToFirst()返回false,一般都是权限问题 ...
- (APP入门)Android Studio照相保存并跳到另一个页面
功能是很简单的功能,主要是想记录一下毫无java基础要怎么写APP. 作为一个光电人,本人的程序设计基础停留在大学的C语言.但学业需要还是捡起了APP编写,由于时间比较紧,是没有学java直接开始AS ...
- JS判断是否是微信页面,判断手机操作系统(ios或android)并跳转到不同下载页面...
JS判断客户端是否是iOS或者Android 参考:http://caibaojian.com/browser-ios-or-android.html 1 function is_weixin() { ...
- android 图片查看动画,Android 共享动画实现点击列表图片跳转查看大图页面
主要内容使用系统提供的 API 实现共享动画 在实现过程中遇到的问题图片点击和关闭之后会出现短暂的黑屏问题实现的动画效果如下: 共享动画.gif 具体实现这个效果是在两个页面之间的切换动画,既然是两个 ...
- android点击通知跳转到服务,Android 接收推送消息跳转到指定页面的方法
问题的提出 本次接入的是个推,其他家的推送没有研究过,思路应该是类似的 App在前台,这个时候需要弹出一个对话框,提醒用户有新的消息,是否要查看,查看的话跳转到指定页面 App在后台,或是App进程已 ...
最新文章
- python格式化字符串_Python的3种字符串格式化方法,哪种你最喜欢?
- 安卓加载asset中的json文件_Android中读取asset路径下本地json文件
- linux进程的堆栈空间_代码段(指令,只读)、数据段(静态变量,全局变量)、堆栈段(局部变量)、栈【转】...
- Android 权限问题
- 移动端 UI 适配最佳实践(中)
- 解决各大浏览器兼容问题hack方法总结
- IOS基础NSOperation的操作优先级和操作依赖
- S2SH CRUD 整合
- sql server模糊查询、分组
- 它们翻滚着的飞秋下载
- 产品入门八——用户体验设计
- 如何禁止IIS缓存静态文件(png,js,html等)(转)
- 读zac老哥《网络营销实战密码》一章有感
- dataframe数据按行做线性拟合
- 基于Proteus学习单片机系列(五)——定时器实现电子表
- Deep Inductive Logic Reasoning深度感应逻辑推理模型 论文笔记
- fastjson使用toJSONString时null值不序列化问题
- 同步以太网-SyncE介绍
- VS异常:文件乱码:文件加载,使用Unicode(UTF-8)编码加载文件xxx时,有些字节已用Unicode替换字符替换。保存该文件将不会保留原始文件内容。
- js 数组(定义数组,数组长度,数组计算,元素类型转换)