Commit 5422f347 authored by mengcuiguang2's avatar mengcuiguang2

添加微信打开小程序功能

parent d547032b
......@@ -11,7 +11,6 @@ import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import android.widget.CompoundButton
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
......@@ -38,6 +37,9 @@ import com.jobo.rxpay.RxPay
import com.jobo.rxpay.callback.IPayCallback
import com.jobo.wxpay.WXPay
import com.jobo.wxpay.WXPayInfoImpl
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram
import com.tencent.mm.opensdk.openapi.IWXAPI
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.youth.banner.listener.OnPageChangeListener
import kotlinx.android.synthetic.main.activity_new_vip.*
import java.net.URLEncoder
......@@ -789,4 +791,22 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
e.printStackTrace()
}
}
*/
/**
* 跳转支付宝小程序
private fun openWxApp() {
// AppConfig.enterAlipay = true
try {
val appId = "wx263e5304a9a67d7c" // 填移动应用(App)的 AppId,非小程序的 AppID
val api: IWXAPI = WXAPIFactory.createWXAPI(context, appId)
val req = WXLaunchMiniProgram.Req()
req.userName = "gh_439c32026e1b" // 填小程序原始id
req.path = "/pages/loading?testApp1=mcg1&testApp2=mcg2" ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE // 可选打开 开发版,体验版和正式版
api.sendReq(req)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
\ No newline at end of file
......@@ -37,7 +37,8 @@ dependencies {
// implementation 'androidx.appcompat:appcompat:1.2.0'
// implementation 'com.google.android.material:material:1.3.0'
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+'
// api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+'
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.4.0'
compileOnly project(":rxpay")
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment