你好官方
我原生插件开发中,我集成Android Stripe SDK时遇到了问题。初始化SDK的时候报了如下错误:
LifecycleOwner io.dcloud.PandoraEntryActivity@201c9fc is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED.
我的诉求:有没有什么解决方案,能让这个方法顺利初始化。包括uts或者其他开发方法都可以。
我的代码:
@UniJSMethod(uiThread = true)
public void initStripe(UniJSCallback callback){
Log.e(TAG,"initStripe is run");
FragmentActivity activity = (FragmentActivity)mUniSDKInstance.getContext();
try {
paymentSheet = new PaymentSheet(activity, new CreateIntentCallback() {
@Override
public Object onCreateIntent(@NonNull PaymentMethod paymentMethod, boolean b, @NonNull Continuation<? super CreateIntentResult> continuation) {
try {
mContinuation = continuation;
// Make a request to your server to create a SetupIntent and return its client secret
// Replace `myNetworkClient.createIntent` with actual implementation
JSONObject data = new JSONObject();
data.put("code", 0);
data.put("msg", "success");
data.put("paymentMethodId","12312");
callback.invoke(data);
} catch (Exception e) {
JSONObject data = new JSONObject();
data.put("code", 1);
data.put("msg", e.getMessage());
callback.invoke(data);
return new CreateIntentResult.Failure(e, e.getMessage());
}
return null;
}
}, new PaymentSheetResultCallback() {
@Override
public void onPaymentSheetResult(@NonNull PaymentSheetResult paymentSheetResult) {
}
});
}catch (Exception e){
Log.e(TAG,e.getMessage());
}
}
qxcl
怎么解决的,能把方案贴出来么
2024-09-14 15:47
4***@qq.com (作者)
回复 qxcl: 解决了
2024-09-14 15:50
4***@qq.com (作者)
回复 qxcl: 兄弟,代码我贴出来了,拿走不谢。得之我幸,失之我更幸,一切发生皆有利于我,加油兄弟。
2024-09-14 16:03
qxcl
回复 4***@qq.com: OK,谢谢兄弟
2024-09-14 16:54