Android 发起加入QQ群、打开网址、启动拨打电话界面
生活随笔
收集整理的這篇文章主要介紹了
Android 发起加入QQ群、打开网址、启动拨打电话界面
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
/****************** 發(fā)起添加群流程。 ** @param key 由官網(wǎng)生成的key* @return 返回true表示呼起手Q成功,返回fals表示呼起失敗******************/public static void joinQQGroup(Activity _this, String key){Intent intent = new Intent();intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key));// 此Flag可根據(jù)具體產(chǎn)品需要自定義,如設(shè)置,則在加群界面按返回,返回手Q主界面,不設(shè)置,按返回會(huì)返回到呼起產(chǎn)品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)try{_this.startActivity(intent);} catch (Exception e){// 未安裝手Q或安裝的版本不支持ToastUtils.show("未安裝手Q或安裝的版本不支持");}}/**撥打電話 (只打開(kāi)撥打電話撥號(hào)界面,不打電話)* @param _this* @param phoneNum*/public static void callTel(Activity _this, String phoneNum){try{Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum));_this.startActivity(intent);}catch (Exception e){ToastUtils.show("設(shè)備不支持撥打電話");Log.e("callTel", "callTel: "+e.getMessage() );}}/**通過(guò)默認(rèn)瀏覽器 打開(kāi)網(wǎng)址* @param _this* @param url*/public static void openUrl(Activity _this, String url){Uri uri = Uri.parse(url);Intent intent = new Intent(Intent.ACTION_VIEW, uri);_this.startActivity(intent);}
QQ群管理地址:https://qun.qq.com/join.html?獲取key
總結(jié)
以上是生活随笔為你收集整理的Android 发起加入QQ群、打开网址、启动拨打电话界面的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Java 比较两个版本号的大小 (通用
- 下一篇: Android Fragment 监听返