<activity
android:name=".wxapi.WXEntryActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:theme="@style/TranslucentTheme"
android:taskAffinity="com.zhugefang.agent"
android:launchMode="singleTask"/>
public class WXEntryActivity extends AppCompatActivity implements IWXAPIEventHandler {
private IWXAPI api;
private SocialHelper socialHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
socialHelper = new SocialHelper.Builder().build();
String wxAppId = socialHelper.getBuilder().getWxAppId();
api = WXAPIFactory.createWXAPI(this, wxAppId, true);
api.registerApp(wxAppId);
try {
api.handleIntent(getIntent(), this);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent, this);
}
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp baseResp) {
Log.d("WXEntryActivity", baseResp.errCode + baseResp.errStr);
if (baseResp.getType() == ConstantsAPI.COMMAND_SENDAUTH) {
if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) {
String code = ((SendAuth.Resp) baseResp).code;
socialHelper.sendAuthBackBroadcast(this, code);
} else {
socialHelper.sendAuthBackBroadcast(this, null);
}
} else if (baseResp.getType() == ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX) {
if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) {
socialHelper.sendShareBackBroadcast(this, true);
} else {
socialHelper.sendShareBackBroadcast(this, false);
}
}
onBackPressed();
}
}
你好,请在复现问题后在手机微信上传日志: 我->设置->帮助与反馈右上角有个上报日志的入口,提供出现问题的微信号,出现问题的时间点(具体到分钟)