我写了个原生Module插件,里面弹出个activity,用离线打包就可以弹出,云打包就不可以弹出,block了。为啥? 就这么简单的代码。startActivityForResult阻塞了。
//run ui thread
@UniJSMethod (uiThread = true)
public void aliPayRequest(JSONObject options) {
Log.e(TAG, "testAsyncFunc--"+options);
if(mUniSDKInstance != null && mUniSDKInstance.getContext() instanceof Activity) {
try {
//FragmentActivity
/*
new AlertDialog.Builder(mUniSDKInstance.getContext())
.setTitle("标题")
.setMessage(" hhhhhhhhhhhh" )
.setPositiveButton("确定", null)
.show();
*/
Intent intent = new Intent(mUniSDKInstance.getContext(), com.zminfotech.unifypay.PayActiviry.class);
intent.putExtra("pay", options.getString("pay"));
//((Activity) mUniSDKInstance.getContext()).startActivityForResult(intent, REQUEST_CODE);
((Activity) mUniSDKInstance.getContext()).startActivity(intent);
/*
new AlertDialog.Builder(mUniSDKInstance.getContext())
.setTitle("标题")
.setMessage(" ggggggggggggggg" )
.setPositiveButton("确定", null)
.show();
*/
//Toast.makeText(mUniSDKInstance.getContext(), options.getString("pay") + "end", Toast.LENGTH_SHORT).show();
}catch (Exception e){
new AlertDialog.Builder(mUniSDKInstance.getContext())
.setTitle("标题")
.setMessage(" err Activity" + e.getMessage())
.setPositiveButton("确定", null)
.show();
}
}else{
new AlertDialog.Builder(mUniSDKInstance.getContext())
.setTitle("标题")
.setMessage(" err Activity")
.setPositiveButton("确定", null)
.show();
}
//String req = options.getString("pay");
//payAliPay(req);
}
咳 (作者)
汗,还有别的获得context的方法么?
2022-03-26 09:52
咳 (作者)
回复 咳: 实现 UniAppHookProxy ??
2022-03-26 10:12