Browse Source

增加生命周期方法

fluty 5 years ago
parent
commit
ab893830f0

+ 40 - 46
app/src/main/java/com/funcheer/channel/sdk/MainActivity.java

@@ -15,6 +15,7 @@ import android.widget.Toast;
 import com.example.fqchannelsdk.R;
 import com.fq.channel.sdk.api.FqGame;
 import com.fq.channel.sdk.api.IResult;
+import com.fq.channel.sdk.api.bean.LoginInfo;
 import com.fq.channel.sdk.base.net.HttpManager;
 import com.fq.channel.sdk.base.net.callback.BaseCallback;
 import com.fq.channel.sdk.base.Exception.BaseException;
@@ -24,9 +25,6 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.util.HashMap;
-//import com.fq.channel.sdk.api.FqGame;
-//import com.fq.channel.sdk.api.bean.LoginInfo;
-//import com.fq.channel.sdk.api.bean.PaymentInfo;
 
 /**
  * @Description: 描述
@@ -43,47 +41,54 @@ public class MainActivity extends Activity implements View.OnClickListener {
         FqLog.i(TAG, "onCreate: ");
         initUI();
         initSDK();
+        FqGame.onCreate(savedInstanceState);
     }
 
     //跟游戏的主Activity走
     @Override
     protected void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
-        //保存状态
+        FqGame.onSaveInstanceState(outState);
     }
 
     @Override
     protected void onNewIntent(Intent intent) {
         super.onNewIntent(intent);
+        FqGame.onNewIntent(intent);
     }
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
+        FqGame.onActivityResult(requestCode, resultCode, data);
     }
 
     @Override
     protected void onRestart() {
         super.onRestart();
         FqLog.i(TAG, "onRestart: ");
+        FqGame.onRestart();
     }
 
     @Override
     protected void onStart() {
         super.onStart();
         FqLog.i(TAG, "onStart: ");
+        FqGame.onStart();
     }
 
     @Override
     protected void onResume() {
         super.onResume();
         FqLog.i(TAG, "onResume: ");
+        FqGame.onResume();
     }
 
     @Override
     protected void onPause() {
         super.onPause();
         FqLog.i(TAG, "onPause: ");
+        FqGame.onPause();
 
     }
 
@@ -91,15 +96,17 @@ public class MainActivity extends Activity implements View.OnClickListener {
     protected void onStop() {
         super.onStop();
         FqLog.i(TAG, "onStop: ");
+        FqGame.onStop();
     }
 
     @Override
     protected void onDestroy() {
         super.onDestroy();
         FqLog.i(TAG, "onDestroy: ");
+        FqGame.onDestroy();
     }
 
-    private void initUI(){
+    private void initUI() {
         findViewById(getResourceId("fq_login", "id")).setOnClickListener(this);
         findViewById(getResourceId("fq_switch_account", "id")).setOnClickListener(this);
         findViewById(getResourceId("fq_logout", "id")).setOnClickListener(this);
@@ -112,7 +119,7 @@ public class MainActivity extends Activity implements View.OnClickListener {
     @Override
     public void onClick(View v) {
         int id = v.getId();
-        switch (id){
+        switch (id) {
             case R.id.fq_login:
                 login();
                 break;
@@ -120,7 +127,7 @@ public class MainActivity extends Activity implements View.OnClickListener {
             case R.id.fq_switch_account:
                 try {
                     switch_account();
-                }catch (JSONException e){
+                } catch (JSONException e) {
                     e.printStackTrace();
                 }
 
@@ -147,52 +154,40 @@ public class MainActivity extends Activity implements View.OnClickListener {
         }
     }
 
-    private int getResourceId(String name, String defType){
+    private int getResourceId(String name, String defType) {
         return this.getResources().getIdentifier(name, defType, this.getPackageName());
     }
 
-    private void initSDK(){
+    private void initSDK() {
         FqGame.init(MainActivity.this, new IResult<String>() {
             @Override
             public void onSuccess(String s) {
-                FqLog.i(TAG,"init success: "+s);
+                FqLog.i(TAG, "init success: " + s);
             }
 
             @Override
             public void onFail(String failMsg) {
-                FqLog.i(TAG,"init fail:"+failMsg);
+                FqLog.i(TAG, "init fail:" + failMsg);
             }
         });
     }
 
 
-    private void login(){
-//        FqGame.login(MainActivity.this, new FqGame.IResult<LoginInfo>() {
-//            @Override
-//            public void onSuccess(LoginInfo s) {
-//                Log.i(TAG,"login success: "+s.getUid());
-//            }
-//
-//            @Override
-//            public void onFail(String failMsg) {
-//                Log.i(TAG,"login fail:"+failMsg);
-//            }
-//        });
-        HttpManager.getInstance().get("http://wwww.baidu.com", new BaseCallback<String>() {
+    private void login() {
+        FqGame.login(MainActivity.this, new IResult<LoginInfo>() {
             @Override
-            public void onFailure(BaseException msg) {
-                FqLog.e(TAG, "onFailure: ");
+            public void onSuccess(LoginInfo s) {
+                FqLog.i(TAG, "login success: " + s.getUid());
             }
 
             @Override
-            public void onSuccess(int code, String msg, String data) {
-                FqLog.i(TAG, "onResponse: " + data);
+            public void onFail(String failMsg) {
+                FqLog.i(TAG, "login fail:" + failMsg);
             }
         });
-
     }
 
-    public void charge(){
+    public void charge() {
 
         //get price
 //        String priceString = ((EditText)findViewById(getResourceId("fq_charge_price",
@@ -236,11 +231,10 @@ public class MainActivity extends Activity implements View.OnClickListener {
     }
 
 
-
     private void exit() {// 退出接口
     }
 
-    private void showGameExitView(){
+    private void showGameExitView() {
         AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
         builder.setTitle("游戏自带退出界面");
         builder.setCancelable(false);
@@ -265,9 +259,9 @@ public class MainActivity extends Activity implements View.OnClickListener {
 
     private void dataReport() {
         //get report data type
-        String dataReportTypeString = ((EditText)findViewById(getResourceId("fq_report_type",
+        String dataReportTypeString = ((EditText) findViewById(getResourceId("fq_report_type",
                 "id"))).getText().toString();
-        if (TextUtils.isEmpty(dataReportTypeString)){
+        if (TextUtils.isEmpty(dataReportTypeString)) {
             showResult("请先填入上报类型");
             return;
         }
@@ -319,17 +313,17 @@ public class MainActivity extends Activity implements View.OnClickListener {
     }
 
     private void switch_account() throws JSONException {
-        HashMap hashMap = new HashMap<String,String>();
+        HashMap hashMap = new HashMap<String, String>();
         JSONObject custom = new JSONObject();
-        custom.put("ssoid","ssoid");
+        custom.put("ssoid", "ssoid");
         custom.put("token", "token");
-        hashMap.put("channelType","ansen");
-        hashMap.put("gameId","123");
-        hashMap.put("imei","123");
-        hashMap.put("channelId","123");
-        hashMap.put("channelParams",custom.toString());
+        hashMap.put("channelType", "ansen");
+        hashMap.put("gameId", "123");
+        hashMap.put("imei", "123");
+        hashMap.put("channelId", "123");
+        hashMap.put("channelParams", custom.toString());
 
-        HttpManager.getInstance().post("http://192.168.1.152:9099/api/sdk/channel/v1/login",hashMap, new BaseCallback<String>() {
+        HttpManager.getInstance().post("http://192.168.1.152:9099/api/sdk/channel/v1/login", hashMap, new BaseCallback<String>() {
             @Override
             public void onFailure(BaseException msg) {
                 Log.i(TAG, "onFailure: ");
@@ -342,12 +336,12 @@ public class MainActivity extends Activity implements View.OnClickListener {
         });
     }
 
-    private void showResult(String message){
+    private void showResult(String message) {
         Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
     }
 
-    private void exitAppProcess(Activity activity){
-        if (!activity.isFinishing()){
+    private void exitAppProcess(Activity activity) {
+        if (!activity.isFinishing()) {
             activity.finish();
         }
         android.os.Process.killProcess(android.os.Process.myPid());
@@ -376,6 +370,6 @@ public class MainActivity extends Activity implements View.OnClickListener {
     public void onRequestPermissionsResult(int requestCode, String[] permissions, int[]
             grantResults) {
         super.onRequestPermissionsResult(requestCode, permissions, grantResults);
-        FqGame.onRequestPermissionsResult(requestCode,permissions,grantResults);
+        FqGame.onRequestPermissionsResult(requestCode, permissions, grantResults);
     }
 }

+ 57 - 48
fq_plugin_api/src/main/java/com/fq/channel/sdk/api/FqGame.java

@@ -2,7 +2,9 @@ package com.fq.channel.sdk.api;
 
 import android.Manifest;
 import android.app.Activity;
+import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.v4.app.ActivityCompat;
 import android.support.v4.content.ContextCompat;
@@ -58,29 +60,8 @@ public class FqGame {
      * @param activity
      */
     public static void login(@NonNull Activity activity, final IResult<LoginInfo> resultLoginInfo) {
-        Log.i(TAG, "login");
-        JointManager.getInstance().login(activity, new PluginResultHandler() {
-            @Override
-            public void onHandlePluginResult(PluginResult result) {
-                Status mStatus = result.getStatus();
-                Log.i(TAG, "login mStatus :" + mStatus);
-
-                if (Status.OK == mStatus) {
-                    Object res_msg = result.getRawMessage();
-                    JSONObject jo = (JSONObject) res_msg;
-                    try {
-                        resultLoginInfo.onSuccess(new LoginInfo(jo.get("uid").toString(), jo.get("token").toString()));
-                    } catch (JSONException e) {
-                        resultLoginInfo.onFail("JSONException");
-                        e.printStackTrace();
-                    }
-                } else if (Status.CANCEL == mStatus) {
-                    resultLoginInfo.onFail(result.getMessage());
-                } else if (Status.ERROR == mStatus) {
-                    resultLoginInfo.onFail(result.getMessage());
-                }
-            }
-        });
+        FqLog.i(TAG, "login");
+        FqGameHander.login(activity,resultLoginInfo);
     }
 
     /**
@@ -91,31 +72,8 @@ public class FqGame {
      * @param resultPay
      */
     public static void pay(@NonNull Activity activity, @NonNull final PaymentInfo paymentInfo, final IResult<String> resultPay) {
-        Log.i(TAG, "pay");
-        try {
-            Map map = Utils.getObjectToMap(paymentInfo);
-            if (map == null){
-                resultPay.onFail("params is null");
-                return;
-            }
-            JointManager.getInstance().pay(activity, map, new PluginResultHandler() {
-                @Override
-                public void onHandlePluginResult(PluginResult result) {
-                    Status mStatus = result.getStatus();
-                    Log.i(TAG, "pay mStatus :" + mStatus);
-                    if (Status.OK == mStatus) {
-                        resultPay.onSuccess(result.getMessage());
-                    } else if (Status.CANCEL == mStatus) {
-                        resultPay.onFail(result.getMessage());
-                    } else if (Status.ERROR == mStatus) {
-                        resultPay.onFail(result.getMessage());
-                    }
-                }
-            });
-        } catch (IllegalAccessException e) {
-            resultPay.onFail("params is null");
-            e.printStackTrace();
-        }
+        FqLog.i(TAG, "pay");
+        FqGameHander.pay(activity, paymentInfo, resultPay);
     }
 
     /**
@@ -128,4 +86,55 @@ public class FqGame {
         ApiPlugin.getInstace().onRequestPermissionsResult(requestCode, permissions, grantResults);
     }
 
+    public  static void onCreate(Bundle savedInstanceState) {
+        FqLog.i(TAG, "onCreate: ");
+        ApiPlugin.getInstace().onCreate(savedInstanceState);
+    }
+
+    public static void onRestart() {
+        FqLog.i(TAG, "onRestart: ");
+        ApiPlugin.getInstace().onRestart();
+    }
+
+    public static void onStart() {
+        FqLog.i(TAG, "onStart: ");
+        ApiPlugin.getInstace().onStart();
+    }
+
+    public static void onResume() {
+        FqLog.i(TAG, "onResume: ");
+        ApiPlugin.getInstace().onResume();
+    }
+
+    public static void onPause() {
+        FqLog.i(TAG, "onPause: ");
+        ApiPlugin.getInstace().onPause();
+
+    }
+
+    public static void onStop() {
+        FqLog.i(TAG, "onStop: ");
+        ApiPlugin.getInstace().onStop();
+    }
+
+    public static void onDestroy() {
+        FqLog.i(TAG, "onDestroy: ");
+        ApiPlugin.getInstace().onDestroy();
+    }
+
+    public static void onSaveInstanceState(Bundle outState) {
+        FqLog.i(TAG, "onSaveInstanceState: ");
+        ApiPlugin.getInstace().onSaveInstanceState(outState);
+    }
+
+    public static void onNewIntent(Intent intent) {
+        FqLog.i(TAG, "onNewIntent: ");
+        ApiPlugin.getInstace().onNewIntent(intent);
+    }
+
+    public static void onActivityResult(int requestCode, int resultCode, Intent data) {
+        FqLog.i(TAG, "onActivityResult: ");
+        ApiPlugin.getInstace().onActivityResult(requestCode, resultCode, data);
+    }
+
 }

+ 60 - 0
fq_plugin_api/src/main/java/com/fq/channel/sdk/api/FqGameHander.java

@@ -3,11 +3,14 @@ package com.fq.channel.sdk.api;
 import android.Manifest;
 import android.app.Activity;
 import android.content.pm.PackageManager;
+import android.support.annotation.NonNull;
 import android.support.v4.app.ActivityCompat;
 import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 import android.util.Log;
 
+import com.fq.channel.sdk.api.bean.LoginInfo;
+import com.fq.channel.sdk.api.bean.PaymentInfo;
 import com.fq.channel.sdk.base.Constants.AppConfig;
 import com.fq.channel.sdk.base.Constants.FqConfig;
 import com.fq.channel.sdk.base.Exception.BaseException;
@@ -23,6 +26,11 @@ import com.fq.channel.sdk.base.utils.FqLog;
 import com.fq.channel.sdk.base.utils.Utils;
 import com.fq.channel.sdk.core.JointManager;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Map;
+
 /**
  * @Description: 描述
  * @Author: FLuty
@@ -105,6 +113,58 @@ public class FqGameHander {
         });
     }
 
+    public static void login(@NonNull Activity activity, final IResult<LoginInfo> resultLoginInfo) {
+        JointManager.getInstance().login(activity, new PluginResultHandler() {
+            @Override
+            public void onHandlePluginResult(PluginResult result) {
+                PluginResult.Status mStatus = result.getStatus();
+                Log.i(TAG, "login mStatus :" + mStatus);
+
+                if (PluginResult.Status.OK == mStatus) {
+                    Object res_msg = result.getRawMessage();
+                    JSONObject jo = (JSONObject) res_msg;
+                    try {
+                        resultLoginInfo.onSuccess(new LoginInfo(jo.get("uid").toString(), jo.get("token").toString()));
+                    } catch (JSONException e) {
+                        resultLoginInfo.onFail("JSONException");
+                        e.printStackTrace();
+                    }
+                } else if (PluginResult.Status.CANCEL == mStatus) {
+                    resultLoginInfo.onFail(result.getMessage());
+                } else if (PluginResult.Status.ERROR == mStatus) {
+                    resultLoginInfo.onFail(result.getMessage());
+                }
+            }
+        });
+    }
+
+    public static void pay(@NonNull Activity activity, @NonNull final PaymentInfo paymentInfo, final IResult<String> resultPay) {
+        try {
+            Map map = Utils.getObjectToMap(paymentInfo);
+            if (map == null){
+                resultPay.onFail("params is null");
+                return;
+            }
+            JointManager.getInstance().pay(activity, map, new PluginResultHandler() {
+                @Override
+                public void onHandlePluginResult(PluginResult result) {
+                    PluginResult.Status mStatus = result.getStatus();
+                    Log.i(TAG, "pay mStatus :" + mStatus);
+                    if (PluginResult.Status.OK == mStatus) {
+                        resultPay.onSuccess(result.getMessage());
+                    } else if (PluginResult.Status.CANCEL == mStatus) {
+                        resultPay.onFail(result.getMessage());
+                    } else if (PluginResult.Status.ERROR == mStatus) {
+                        resultPay.onFail(result.getMessage());
+                    }
+                }
+            });
+        } catch (IllegalAccessException e) {
+            resultPay.onFail("params is null");
+            e.printStackTrace();
+        }
+    }
+
     protected static void onRequestPermissionsResult(int requestCode,
                                                      String[] permissions, int[] grantResults) {
         if (REQUEST_CODE_READ_PHONE_STATE == requestCode

+ 196 - 79
fq_plugin_core/src/main/java/com/fq/channel/sdk/core/invoke/ApiPlugin.java

@@ -1,95 +1,212 @@
 package com.fq.channel.sdk.core.invoke;
 
 import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
 import android.util.Log;
 
+import com.fq.channel.sdk.base.Constants.FqConfig;
 import com.fq.channel.sdk.base.Exception.NoSuchFunctionException;
 import com.fq.channel.sdk.base.interfaces.PluginResult;
 import com.fq.channel.sdk.base.interfaces.PluginResultHandler;
+import com.fq.channel.sdk.base.utils.FqLog;
 
 import java.util.Map;
 
 public class ApiPlugin extends ApiReflectManager {
 
-	protected String TAG = getClass().getSimpleName() ;
-
-
-	private static byte[] sync = new byte[0];
-	private static ApiPlugin instance = null;
-
-	public static ApiPlugin getInstace() {
-		if (instance == null) {
-			synchronized (sync) {
-				instance = new ApiPlugin();
-			}
-		}
-		return instance;
-	}
-
-	private ApiPlugin() {
-
-	}
-
-	Handler mainHandler = new Handler(Looper.getMainLooper());
-
-	public void post(Runnable r) {
-		mainHandler.post(r);
-	}
-
-
-	public void init(Context context, PluginResultHandler cb) {
-		if(cb == null) {
-			Log.e(TAG, "====initialize====的回调函数为null,请初始化");
-			return;
-		}
-
-		try {
-			invoke(getDeclaredMethod("init", Context.class, PluginResultHandler.class),
-					context, cb);
-		} catch (NoSuchFunctionException e) {
-			Log.e(TAG, "initialize NoSuchFunctionException");
-			e.printStackTrace();
-			cb.onHandlePluginResult(new PluginResult(PluginResult.Status.ERROR));
-		}
-	}
-
-
-	public void login(Context context, PluginResultHandler cb) {
-
-		if(cb == null) {
-			Log.e(TAG, "====login====的回调函数为null,请初始化");
-			return;
-		}
-		try {
-			invoke(getDeclaredMethod("login", Context.class, PluginResultHandler.class),
-					context, cb);
-		} catch (NoSuchFunctionException e) {
-			Log.e(TAG, "login NoSuchFunctionException");
-			e.printStackTrace();
-			cb.onHandlePluginResult(new PluginResult(PluginResult.Status.ERROR));
-		}
-
-	}
-
-	public void pay(Context context,Map map, PluginResultHandler cb) {
-
-		if(cb == null) {
-			Log.e(TAG, "====pay====的回调函数为null,请初始化");
-			return;
-		}
-		try {
-			invoke(getDeclaredMethod("pay", Context.class,Map.class, PluginResultHandler.class),
-					context,map, cb);
-		} catch (NoSuchFunctionException e) {
-			Log.e(TAG, "login NoSuchFunctionException");
-			e.printStackTrace();
-			cb.onHandlePluginResult(new PluginResult(PluginResult.Status.ERROR));
-		}
-
-	}
-
-	public void onRequestPermissionsResult(int requestCode,
-												  String[] permissions, int[] grantResults){}
+    protected String TAG = getClass().getSimpleName();
+
+
+    private static byte[] sync = new byte[0];
+    private static ApiPlugin instance = null;
+
+    public static ApiPlugin getInstace() {
+        if (instance == null) {
+            synchronized (sync) {
+                instance = new ApiPlugin();
+            }
+        }
+        return instance;
+    }
+
+    private ApiPlugin() {
+
+    }
+
+    Handler mainHandler = new Handler(Looper.getMainLooper());
+
+    public void post(Runnable r) {
+        mainHandler.post(r);
+    }
+
+
+    public void init(Context context, PluginResultHandler cb) {
+        if (cb == null) {
+            Log.e(TAG, "====initialize====的回调函数为null,请初始化");
+            return;
+        }
+
+        try {
+            invoke(getDeclaredMethod("init", Context.class, PluginResultHandler.class),
+                    context, cb);
+        } catch (NoSuchFunctionException e) {
+            Log.e(TAG, "initialize NoSuchFunctionException");
+            e.printStackTrace();
+            cb.onHandlePluginResult(new PluginResult(PluginResult.Status.ERROR));
+        }
+    }
+
+
+    public void login(Context context, PluginResultHandler cb) {
+
+        if (cb == null) {
+            Log.e(TAG, "====login====的回调函数为null,请初始化");
+            return;
+        }
+        try {
+            invoke(getDeclaredMethod("login", Context.class, PluginResultHandler.class),
+                    context, cb);
+        } catch (NoSuchFunctionException e) {
+            Log.e(TAG, "login NoSuchFunctionException");
+            e.printStackTrace();
+            cb.onHandlePluginResult(new PluginResult(PluginResult.Status.ERROR));
+        }
+
+    }
+
+    public void pay(Context context, Map map, PluginResultHandler cb) {
+
+        if (cb == null) {
+            Log.e(TAG, "====pay====的回调函数为null,请初始化");
+            return;
+        }
+        try {
+            invoke(getDeclaredMethod("pay", Context.class, Map.class, PluginResultHandler.class),
+                    context, map, cb);
+        } catch (NoSuchFunctionException e) {
+            Log.e(TAG, "login NoSuchFunctionException");
+            e.printStackTrace();
+            cb.onHandlePluginResult(new PluginResult(PluginResult.Status.ERROR));
+        }
+
+    }
+
+    public void setExtraBundle(Bundle data) {
+        try {
+            invoke(getDeclaredMethod("setExtraBundle", Bundle.class), data);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====setExtraBundle====没有实现该函数");
+        }
+    }
+
+    public void onCreate(Bundle savedInstanceState) {
+        try {
+            invoke(getDeclaredMethod("onCreate" ,Bundle.class), savedInstanceState);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onCreate====没有实现该函数");
+        }
+    }
+
+    public void onSaveInstanceState(Bundle outState) {
+        try {
+            invoke(getDeclaredMethod("onSaveInstanceState", Bundle.class), outState);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onSaveInstanceState====没有实现该函数");
+        }
+    }
+
+    public void onRestart() {
+        try {
+            invoke(getDeclaredMethod("onRestart"));
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onRestart====没有实现该函数");
+        }
+    }
+
+    public void onStart() {
+        try {
+            invoke(getDeclaredMethod("onStart"));
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onStart====没有实现该函数");
+        }
+    }
+
+    public void onResume() {
+        try {
+            invoke(getDeclaredMethod("onResume"));
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onResume====没有实现该函数");
+        }
+    }
+
+    public void onPause() {
+        try {
+            invoke(getDeclaredMethod("onPause"));
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onPause====没有实现该函数");
+        }
+    }
+
+    public void onStop() {
+        try {
+            invoke(getDeclaredMethod("onStop"));
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onStop====没有实现该函数");
+        }
+    }
+
+    public void onNewIntent(Intent intent) {
+        try {
+            invoke(getDeclaredMethod("onNewIntent", Intent.class), intent);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onNewIntent====没有实现该函数");
+        }
+    }
+
+    public void onDestroy() {
+        try {
+            invoke(getDeclaredMethod("onDestroy"));
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onDestroy====没有实现该函数");
+        }
+    }
+
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        try {
+            invoke(getDeclaredMethod("onActivityResult", int.class, int.class, Intent.class),
+                    requestCode, resultCode, data);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onActivityResult====没有实现该函数");
+        }
+    }
+
+    public void onRequestPermissionsResult(int requestCode,
+                                           String[] permissions, int[] grantResults) {
+        try {
+            invoke(getDeclaredMethod("onActivityResult", int.class, String.class, Intent.class),
+                    requestCode, permissions, grantResults);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onActivityResult====没有实现该函数");
+        }
+    }
+
+    public void attachBaseContext(Context context) {
+        try {
+            invoke(getDeclaredMethod("attachBaseContext", Context.class), context);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====attachBaseContext====没有实现该函数");
+        }
+    }
+
+    public void onApplicationCreate(Context context) {
+        try {
+            invoke(getDeclaredMethod("onApplicationCreate", Context.class), context);
+        } catch (NoSuchFunctionException e) {
+            FqLog.e(TAG, "====onApplicationCreate====没有实现该函数");
+        }
+    }
+
 }