diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java index 23092ff..bd03f09 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java @@ -25,10 +25,14 @@ public class ExtensionApiModule extends BaseApi { private static final String TAG = "ExtensionApiModule"; + private final Context cur; + private Handler handler = new Handler(Looper.getMainLooper()); public ExtensionApiModule(Context context) { super(context); + cur = context; + } @Override @@ -38,13 +42,13 @@ public class ExtensionApiModule extends BaseApi { @Override public void invoke(String s, Map param, ICallback iCallback) { - boolean isFinAppProcess = FinAppClient.INSTANCE.isFinAppProcess(getContext()); + boolean isFinAppProcess = FinAppClient.INSTANCE.isFinAppProcess(cur); Log.d(TAG, "ExtensionApiModule invoke register api s:" + s + " param:" + param +" isFinAppProcess:"+isFinAppProcess); if(s.equals("registerExtensionApi")) { MethodChannel channel = MopPluginService.getInstance().getMethodChannel(); String name = (String) param.get("name"); Log.d(TAG, "registerExtensionApi:" + name); - FinAppClient.INSTANCE.getExtensionApiManager().registerApi(new com.finogeeks.lib.applet.api.BaseApi(getContext()) { + FinAppClient.INSTANCE.getExtensionApiManager().registerApi(new com.finogeeks.lib.applet.api.BaseApi(cur) { @Override public String[] apis() { return new String[]{name}; @@ -101,7 +105,7 @@ public class ExtensionApiModule extends BaseApi { MethodChannel channel = MopPluginService.getInstance().getMethodChannel(); String name = (String) param.get("name"); Log.d(TAG, "registerSyncExtensionApi:" + name); - FinAppClient.INSTANCE.getExtensionApiManager().registerApi(new com.finogeeks.lib.applet.api.BaseApi(getContext()) { + FinAppClient.INSTANCE.getExtensionApiManager().registerApi(new com.finogeeks.lib.applet.api.BaseApi(cur) { @Override public String[] apis() { return new String[]{name}; @@ -158,7 +162,7 @@ public class ExtensionApiModule extends BaseApi { MethodChannel channel = MopPluginService.getInstance().getMethodChannel(); String name = (String) param.get("name"); Log.d(TAG, "addWebExtentionApi:" + name); - FinAppClient.INSTANCE.getExtensionWebApiManager().registerApi(new com.finogeeks.lib.applet.api.BaseApi(getContext()) { + FinAppClient.INSTANCE.getExtensionWebApiManager().registerApi(new com.finogeeks.lib.applet.api.BaseApi(cur) { @Override public String[] apis() { return new String[]{name};