WXAPIFactory.createWXAPI(this, AppId,true)
api.registerApp(AppId);
都没有问题
api.handleIntent(getIntent(), this)返回false;
导致这俩个方法接收不到任何消息
@Override
public void onReq(BaseReq baseReq) {
Log.d(TAG,"微信发送请求:" + baseReq.openId);
finish();
}
@Override
public void onResp(BaseResp baseResp){
Log.d(TAG,"微信响应" + baseResp.errCode);
finish();
}
关键代码
public class GameUnityPlayer extends UnityPlayerActivity implements IWXAPIEventHandler{
//登录
public void LoginWX(){
api = WXAPIFactory.createWXAPI(this, AppId,true);
Log.d(TAG,"API==null?"+(api==null));
boolean issu = api.registerApp(AppId);
Log.d(TAG,"SDK Instance ~~~~~~~~~!"+issu );
boolean isSuccess= api.handleIntent(getIntent(), this);//这里有问题
Log.d(TAG,"SDK ZhuCeWX ~~~~~~~~~!"+isSuccess );
SendAuth.Req req = new SendAuth.Req();
req.scope = "snsapi_userinfo";
req.state = "wechat_sdk_demo_test";
api.sendReq(req);
Log.d(TAG,"SDK LoginWX ~~~~~~~~~!" );
}
}
log日志里面就一句话提示
2022-01-28 10:36:53.276 13646-13744/? I/MicroMsg.SDK.WXApiImplV10: handleIntent fail, intent not from weixin msg
Xml配置
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<queries>
<package android:name="com.tencent.mm" />
</queries>
<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config">
<activity android:name="*.GameUnityPlayer" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden" android:exported="true" android:launchMode="singleTop" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:taskAffinity="*">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
求助大神们 帮帮忙感谢
同遇到问题, 前辈解决了么?