android app添加捐赠项,支付宝捐赠
2018-03-23 16:21
387 查看
开发自己的app一般都会设置一个捐赠,自己摸索了一段时间,写下自己发现的方式
去这个官网下载支付宝的付款码:https://qr.alipay.com
如图:
去这个官网下载支付宝的付款码:https://qr.alipay.com
如图:
- 用微信扫一下二维码,复制网站:如下:https://qr.alipay.com/**a6x076306bxhk8outhwdr67** - (为什么用微信的,因为微信和支付宝不兼容,不会跳转到支付宝,可以获取到链接) 我们要的就是 a6x076306bxhk8outhwdr67这一段 通过替换({替换处})`"intent://platformapi/startapp?saId=10000007&" + "clientVersion=3.7.0.0718&qrcode=https%3A%2F%2Fqr.alipay.com%2F{替换处}%3F_s" + "%3Dweb-other&_t=1472443966571#Intent;" + "scheme=alipayqr;package=com.eg.android.AlipayGphone;end";` 获取自己的url然后使用intent跳转即可 /** * 判断支付宝客户端是否已安装,建议调用转账前检查 * @return 支付宝客户端是否已安装 */ public static boolean hasInstalledAlipayClient() { String ALIPAY_PACKAGE_NAME = "com.eg.android.AlipayGphone"; PackageManager pm = MyApplication.getContext().getPackageManager(); try { PackageInfo info = pm.getPackageInfo(ALIPAY_PACKAGE_NAME, 0); return info != null; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return false; } } /*** * 支付宝转账 * @param activity * **/ public static void openALiPay(Activity activity){ String url1="intent://platformapi/startapp?saId=10000007&" + "clientVersion=3.7.0.0718&qrcode=https%3A%2F%2Fqr.alipay.com%2Fa6x076306bxhk8outhwdr67%3F_s" + "%3Dweb-other&_t=1472443966571#Intent;" + "scheme=alipayqr;package=com.eg.android.AlipayGphone;end"; //String url1=activity.getResources().getString(R.string.alipay); Intent intent = null; Toast.makeText(MyApplication.getContext(),"感谢您的捐赠!٩(๑❛ᴗ❛๑)۶",Toast.LENGTH_SHORT).show(); if(hasInstalledAlipayClient()){ try { intent = Intent.parseUri(url1 ,Intent.URI_INTENT_SCHEME ); activity.startActivity(intent); } catch (URISyntaxException e) { e.printStackTrace(); Toast.makeText(MyApplication.getContext(),"出错啦",Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(MyApplication.getContext(),"您未安装支付宝哦!(>ω・* )ノ",Toast.LENGTH_SHORT).show(); } }
相关文章推荐
- Android APP 内部捐赠实现(支付宝&微信)
- eclipse 添加android-support-v7-appcompat包
- android通过webview调起支付宝app支付
- App添加android:sharedUserId="android.uid.system"的作用
- Android App集成支付宝
- 1.2_Android Training 学习笔记_添加App Bar
- 支付宝APP支付Android与IONIC与服务端,服务端类库从android端考取
- 如何在Android Quick Search Box中添加自己的app,按照我的意愿去Search。
- 如何在android桌面添加几个app图标做快捷方式
- Android内核开发:在源码树中添加新的app应用
- AndroidApp添加签名证书
- android系统源码中添加app源码(源码部署移植)
- android app 接入支付宝
- android app小白试水2-添加图片和文字滚动条
- 如何在android桌面添加几个app图标做快捷方式?
- APP添加CNZZ统计插件教程 Android版添加phonegap
- Android学习系列(28)--App集成支付宝[已过期]
- Android学习探索之App多渠道打包及动态添加修改资源属性
- android添加默认appwidget
- Android App集成支付宝