Browse Source

极光推送通过自定义来显示通知

zengjiebin 7 years ago
parent
commit
a214527b7a

+ 15 - 15
app/build.gradle

@@ -75,7 +75,7 @@ android {
             applicationId "com.sheep.jiuyan.samllsheep"
             manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptest",
                                     DUANDUAN_DATASHARE: "sheeptest",
-                                    jpush_appkey      : "4fea09bdbf9661a9689ee306",
+                                    jpush_appkey      : "627ffad0b1cdf701d15e027a",
                                     umeng_app_key     : "5ab0a1da8f4a9d742900035f"
             ]
             buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptest"'
@@ -85,20 +85,20 @@ android {
             buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
             signingConfig signingConfigs.config
         }
-//        sheeptestjiguang {
-//            applicationId "com.sheep.jiuyan.samllsheep.test"
-//            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptestjiguang",
-//                                    DUANDUAN_DATASHARE: "sheeptestjiguang",
-//                                    jpush_appkey      : "4fea09bdbf9661a9689ee306",
-//                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
-//            ]
-//            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptestjiguang"'
-//            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptestjiguang"'
-//            buildConfigField "String", "app_name", '"小绵羊测试"'
-//            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
-//            buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
-//            signingConfig signingConfigs.config
-//        }
+        sheeptestjiguang {
+            applicationId "com.sheep.jiuyan.samllsheep.test"
+            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptestjiguang",
+                                    DUANDUAN_DATASHARE: "sheeptestjiguang",
+                                    jpush_appkey      : "627ffad0b1cdf701d15e027a",
+                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
+            ]
+            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptestjiguang"'
+            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptestjiguang"'
+            buildConfigField "String", "app_name", '"小绵羊测试"'
+            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
+            buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
+            signingConfig signingConfigs.config
+        }
         sheep {
             applicationId "com.sheep.jiuyan.samllsheep"
             manifestPlaceholders = [DUANDUAN_GRAPH    : "sheep",

+ 67 - 28
app/src/main/java/com/sheep/gamegroup/receiver/SheepJpushReceiver.java

@@ -1,20 +1,28 @@
 package com.sheep.gamegroup.receiver;
 
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.BitmapFactory;
 import android.os.Bundle;
+import android.support.v4.app.NotificationCompat;
 import android.text.TextUtils;
 import android.util.Log;
 
 
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.view.activity.MiddleAct;
+import com.sheep.gamegroup.view.activity.SplashAct;
+import com.sheep.jiuyan.samllsheep.R;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.util.Iterator;
+import java.util.Random;
 
 import cn.jpush.android.api.JPushInterface;
 
@@ -22,7 +30,7 @@ import cn.jpush.android.api.JPushInterface;
  * Created by realicing on 2018/5/9.
  * realicing@sina.com
  * 自定义接收器
- *
+ * <p>
  * 如果不定义这个 Receiver,则:
  * 1) 默认用户会打开主界面
  * 2) 接收不到自定义消息
@@ -59,14 +67,14 @@ public class SheepJpushReceiver extends BroadcastReceiver {
                 Log.d(TAG, "[SheepJpushReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
                 //在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
 
-            } else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
+            } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
                 boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
-                Log.w(TAG, "[SheepJpushReceiver]" + intent.getAction() +" connected state change to "+connected);
+                Log.w(TAG, "[SheepJpushReceiver]" + intent.getAction() + " connected state change to " + connected);
             } else {
                 Log.d(TAG, "[SheepJpushReceiver] Unhandled intent - " + intent.getAction());
             }
-        } catch (Exception ignored){
-
+        } catch (Exception e) {
+            e.printStackTrace();
         }
 
     }
@@ -77,7 +85,7 @@ public class SheepJpushReceiver extends BroadcastReceiver {
         for (String key : bundle.keySet()) {
             if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
                 sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
-            }else if(key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)){
+            } else if (key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
                 sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
             } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
                 if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
@@ -87,12 +95,12 @@ public class SheepJpushReceiver extends BroadcastReceiver {
 
                 try {
                     JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
-                    Iterator<String> it =  json.keys();
+                    Iterator<String> it = json.keys();
 
                     while (it.hasNext()) {
                         String myKey = it.next();
                         sb.append("\nkey:" + key + ", value: [" +
-                                myKey + " - " +json.optString(myKey) + "]");
+                                myKey + " - " + json.optString(myKey) + "]");
                     }
                 } catch (JSONException e) {
                     Log.e(TAG, "Get message extra JSON error!");
@@ -105,25 +113,56 @@ public class SheepJpushReceiver extends BroadcastReceiver {
         return sb.toString();
     }
 
-    //send msg to MainActivity
-    private void processCustomMessage(Context context, Bundle bundle) {
-//        if (MainActivity.isForeground) {
-//            String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
-//            String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
-//            Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
-//            msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
-//            if (!ExampleUtil.isEmpty(extras)) {
-//                try {
-//                    JSONObject extraJson = new JSONObject(extras);
-//                    if (extraJson.length() > 0) {
-//                        msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
-//                    }
-//                } catch (JSONException e) {
-//
-//                }
-//
-//            }
-//            LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
-//        }
+    /**
+     * 处理自定义消息
+     * @param context
+     * @param bundle
+     * @throws JSONException
+     */
+    private void processCustomMessage(Context context, Bundle bundle) throws JSONException {
+        int id = new Random().nextInt(113920);
+//        bundle.putInt("android_notification_id", id);
+        JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
+        String msg = json.optString("msg");
+        String title = json.optString("title");
+        //为了版本兼容  选择V7包下的NotificationCompat进行构造
+        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, "" + id);
+        //点击通知栏跳转到相应的应用里面
+        Intent notificationIntent = new Intent(context, MiddleAct.class);
+        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        notificationIntent.putExtras(bundle);
+
+        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+        notificationBuilder
+                //下拉显示的大图标
+//                .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.icon))
+//                .setSmallIcon(R.mipmap.remenyx)//系统状态栏显示的小图标 remenyx
+                .setSmallIcon(R.drawable.icon)
+                .setWhen(System.currentTimeMillis())
+                .setTicker(title)//Ticker是状态栏显示的提示
+                .setContentTitle("小绵羊")//第一行内容  通常作为通知栏标题
+                .setContentText(title)//第二行内容 通常是通知正文
+                .setOngoing(true)//禁止滑动删除
+                .setDefaults(NotificationCompat.DEFAULT_ALL);
+        if (!TextUtils.isEmpty(msg)) {
+            notificationBuilder.setSubText(msg);//第三行内容 通常是内容摘要什么的 在低版本机器上不一定显示
+            notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().setBigContentTitle(title).setSummaryText("来自:小绵羊").bigText(msg));
+        } else {
+//           notificationBuilder.setSubText("subText");
+            //添加宽视图
+            NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
+            style.setBigContentTitle(title);
+            //由手机屏幕像素决定显示多少
+//          style.addLine("line1");
+//          style.addLine("line2");
+            style.setSummaryText("来自:小绵羊");//添加概要
+            notificationBuilder.setStyle(style);
+        }
+        notificationBuilder.setPriority(Notification.PRIORITY_MAX).setContentIntent(pendingIntent);//点击跳转的intent
+        Notification notification = notificationBuilder.build();
+        notification.flags |= Notification.FLAG_AUTO_CANCEL;
+        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
+        if (mNotificationManager != null)
+            mNotificationManager.notify(id, notification);
     }
 }

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/util/DataUtil.java

@@ -303,7 +303,7 @@ public class DataUtil {
     //是否使用小绵羊截图方案
     public static boolean IS_USE_SCREEN_SHOT = false;//默认开启小剪刀截图,有很多问题,调整到单独的后台进程再测试
     //是否监听媒体库图片变化
-    public static boolean IS_LISTEN_SCREEN_SHOT = true;
+    public static boolean IS_LISTEN_SCREEN_SHOT = false;
     //是否上传截图时使用所有图片
     public static boolean IS_USE_ALL_IMAGE = true;
     //初始化是否启用小绵羊两种截图方案

+ 49 - 2
app/src/main/java/com/sheep/gamegroup/util/TestUtil.java

@@ -3,6 +3,8 @@ package com.sheep.gamegroup.util;
 import android.app.Activity;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.NotificationManagerCompat;
 import android.support.v7.app.AlertDialog;
 import android.text.TextUtils;
 import android.util.Log;
@@ -11,6 +13,7 @@ import android.view.View;
 import android.widget.ArrayAdapter;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
 import com.bumptech.glide.Glide;
 import com.kfzs.duanduan.view.DialogStorageLow;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -26,6 +29,7 @@ import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.ActSheepApkList;
 import com.sheep.gamegroup.view.activity.ActSheepPngList;
 import com.sheep.gamegroup.view.activity.ActWeb;
+import com.sheep.gamegroup.view.activity.NotificationsUtils;
 import com.sheep.gamegroup.view.dialog.DialogGameOrTaskOrGift;
 import com.sheep.gamegroup.view.dialog.DialogLoading;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
@@ -38,15 +42,19 @@ import com.sheep.jiuyan.samllsheep.utils.DeviceUtils;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
+import com.umeng.commonsdk.debug.I;
 import com.umeng.socialize.ShareAction;
 import com.umeng.socialize.UMShareListener;
 import com.umeng.socialize.bean.SHARE_MEDIA;
 import com.umeng.socialize.media.UMImage;
 
 import java.io.File;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
+import cn.jpush.android.api.JPushInterface;
 import rx.android.schedulers.AndroidSchedulers;
 import rx.functions.Action1;
 import rx.schedulers.Schedulers;
@@ -209,7 +217,7 @@ public class TestUtil {
      */
     public static void test(final Activity activity) {
         final String[] items = {"复制token","复制打点数据","从jenkins下载小绵羊安装包","龙猫竞猜","龙猫竞猜-scheme",
-                "测试支付","测试内部h5", "测试外部h5",
+                "测试自定义通知栏","测试自定义通知栏2","开启通知栏权限","通知栏权限1","通知栏权限2","通知栏权限8.0","测试支付","测试内部h5", "测试外部h5",
                 "会长推广游戏","移动积分兑换","审核中心","检查正版","crc32","loading","progress","查看截图",
                 "复制IMEI","小米游戏","测试可用金额","测试定位信息","测试apk的渠道","幂动科技","游戏搜索",
                 "游戏帐号","游戏代充","尝试开启第三方应用使用情况","测试代理页面","第三方应用使用情况",
@@ -223,8 +231,47 @@ public class TestUtil {
                     @Override
                     public void onClick(DialogInterface dialog, int which) {
                         switch (items[which]) {
+                            case "测试自定义通知栏":
+                                Intent bdIntent = new Intent();
+                                bdIntent.setAction(JPushInterface.ACTION_MESSAGE_RECEIVED);
+                                Bundle bundle = new Bundle();
+                                bundle.putString(JPushInterface.EXTRA_MESSAGE, "测试"+JPushInterface.EXTRA_MESSAGE);
+                                Map<String, Object> map = new HashMap<>();
+                                map.put("title", "测试title");
+                                map.put("msg", "测试msgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg");
+                                map.put("type", 71);
+                                map.put("url", "www.baidu.com");
+                                bundle.putString(JPushInterface.EXTRA_EXTRA, JSON.toJSONString(map));
+                                bdIntent.putExtras(bundle);
+                                activity.sendBroadcast(bdIntent);
+                                break;
+                            case "测试自定义通知栏2":
+                                Intent bdIntent2 = new Intent();
+                                bdIntent2.setAction(JPushInterface.ACTION_MESSAGE_RECEIVED);
+                                Bundle bundle2 = new Bundle();
+                                bundle2.putString(JPushInterface.EXTRA_MESSAGE, "测试"+JPushInterface.EXTRA_MESSAGE);
+                                Map<String, Object> map2 = new HashMap<>();
+                                map2.put("title", "测试title");
+                                map2.put("type", 71);
+                                map2.put("url", "www.baidu.com");
+                                bundle2.putString(JPushInterface.EXTRA_EXTRA, JSON.toJSONString(map2));
+                                bdIntent2.putExtras(bundle2);
+                                activity.sendBroadcast(bdIntent2);
+                                break;
+                            case "开启通知栏权限":
+                                NotificationsUtils.goToNotificationSetting(activity);
+                                break;
+                            case "通知栏权限1":
+                                G.showToast(""+NotificationManagerCompat.from(activity).areNotificationsEnabled());
+                                break;
+                            case "通知栏权限2":
+                                G.showToast(""+NotificationsUtils.isNotificationEnabled(activity));
+                                break;
+                            case "通知栏权限8.0":
+                                G.showToast(""+NotificationsUtils.isEnableV26(activity));
+                                break;
                             case "测试支付":
-                                Jump2View.getInstance().goActPay(activity, "6458650174678896640", SpUtils.getToken(activity));
+                                Jump2View.getInstance().goActPay(activity, "6460393611589586944", SpUtils.getToken(activity));
                                 break;
                             case "测试内部h5":
                                 Jump2View.getInstance().goWeb(activity, "www.17xmy.com/", "小绵羊官网");

+ 11 - 5
app/src/main/java/com/sheep/gamegroup/view/activity/ActPay.java

@@ -116,9 +116,14 @@ public class ActPay extends BaseActivity{
             order_no = bundle.getString("order_no");
             token = bundle.getString("token");
         }
-        if(TextUtils.isEmpty(token) || TextUtils.isEmpty(order_no)){//传过来的数据有问题
-            status = STATUS_INIT_ERROR;
-            G.showToast(R.string.error_data);
+        if(TextUtils.isEmpty(order_no)){//传过来的数据有问题
+            status = STATUS_INIT_ERROR_ORDER_NO;
+            G.showToast(R.string.coming_soon);
+            return;
+        }
+        if(TextUtils.isEmpty(order_no)){//传过来的数据有问题
+            status = STATUS_INIT_ERROR_TOKEN;
+            G.showToast(R.string.coming_soon);
             return;
         }
         if(BuildConfig.DEBUG)
@@ -202,8 +207,9 @@ public class ActPay extends BaseActivity{
     public static final int STATUS_PAY_ORDER_SUCCESS = 2;//支付order成功
     public static final int STATUS_GET_ORDER_ERROR = -1;//获取order错误
     public static final int STATUS_PAY_ORDER_ERROR = -2;//支付order错误
-    public static final int STATUS_INIT_ERROR = -3;//初始化时获取到的order_no或token为空
-    public static final int STATUS_GET_ORDER_SUCCESS_ERROR = -4;//获取order接口成功,但是无数据
+    public static final int STATUS_INIT_ERROR_ORDER_NO = -3;//初始化时获取到的order_no为空
+    public static final int STATUS_INIT_ERROR_TOKEN = -4;//初始化时获取到的token为空
+    public static final int STATUS_GET_ORDER_SUCCESS_ERROR = -5;//获取order接口成功,但是无数据
     //点击返回
     public void onClickBackImg(View view) {
         onClickCancel(null);

+ 29 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/NotificationsUtils.java

@@ -1,6 +1,7 @@
 package com.sheep.gamegroup.view.activity;
 
 import android.app.AppOpsManager;
+import android.app.NotificationManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
@@ -17,9 +18,37 @@ import java.lang.reflect.Method;
 public class NotificationsUtils {
     private static final String CHECK_OP_NO_THROW = "checkOpNoThrow";
     private static final String OP_POST_NOTIFICATION = "OP_POST_NOTIFICATION";
+    /**
+     * 8.0以上获取t通知栏状态
+     * @param context
+     * @return
+     */
+    public static boolean isEnableV26(Context context) {
+        String pkg = context.getApplicationContext().getPackageName();
+        try {
+            NotificationManager notificationManager = (NotificationManager)
+                    context.getSystemService(Context.NOTIFICATION_SERVICE);
+            Method sServiceField = notificationManager.getClass().getDeclaredMethod("getService");
+            sServiceField.setAccessible(true);
+            Object sService = sServiceField.invoke(notificationManager);
 
+            Method method = sService.getClass().getDeclaredMethod("areNotificationsEnabledForPackage"
+                    , String.class, Integer.TYPE);
+            method.setAccessible(true);
+            return (boolean) method.invoke(sService, pkg, context.getApplicationInfo().uid);
+        } catch (Exception e) {
+            return true;
+        }
+    }
     public static boolean isNotificationEnabled(Context context) {
         boolean Enabled;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            //8.0手机以上
+            NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
+            if (notificationManager != null && notificationManager.getImportance() != NotificationManager.IMPORTANCE_NONE) {
+                return true;
+            }
+        }
         if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
             AppOpsManager mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
             ApplicationInfo appInfo = context.getApplicationInfo();

+ 8 - 12
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -14,11 +14,8 @@ import com.baidu.location.BDLocation;
 import com.baidu.location.LocationClient;
 import com.baidu.location.LocationClientOption;
 import com.bumptech.glide.Glide;
-import com.liulishuo.okdownload.DownloadMonitor;
 import com.liulishuo.okdownload.OkDownload;
-import com.liulishuo.okdownload.core.breakpoint.RemitStoreOnSQLite;
 import com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher;
-import com.mdad.sdk.mdsdk.monitor.MonitorService;
 import com.sheep.gamegroup.di.components.DaggerNetComponent;
 import com.sheep.gamegroup.di.components.NetComponent;
 import com.sheep.gamegroup.di.modules.NetModule;
@@ -35,7 +32,6 @@ import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.RefreshUtil;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
-import com.sheep.gamegroup.view.activity.ActDownloadMgr;
 import com.sheep.gamegroup.view.activity.GameCertificationActivity;
 import com.sheep.gamegroup.view.activity.LoginAct;
 import com.sheep.jiuyan.samllsheep.service.AutoCheckService;
@@ -216,7 +212,7 @@ public class SheepApp extends MultiDexApplication {
         JPushInterface.setDebugMode(org.xutils.BuildConfig.DEBUG);
         JPushInterface.init(this);
 
-        initBdLocationOpstion();
+        initBdLocationOption();
 
         //设置下载工具
         DownloadDispatcher.setMaxParallelRunningCount(1000);//在这里,下载框架好像有个bug,如果设置为5,第一个下载会占4个,第二个下载就只有一个在下载,就会失败
@@ -225,7 +221,7 @@ public class SheepApp extends MultiDexApplication {
 
     }
 
-    private void initBdLocationOpstion() {
+    private void initBdLocationOption() {
         mLocationClient = new LocationClient(getApplicationContext());
         //声明LocationClient类
         mLocationClient.registerLocationListener(myListener);
@@ -352,7 +348,7 @@ public class SheepApp extends MultiDexApplication {
                 }
                 AppUsageManager.getInstance().needOpenLookAppUsageStatsPermission(true);//尝试保存应用使用情况的数据
                 LogUtil.println("SheepApp onActivityCreated", activity.getClass().getSimpleName(), mActivityCount);
-                if(!UMConfigUtils.isNotNeedAct(activity))
+                if (!UMConfigUtils.isNotNeedAct(activity))
                     UMConfigUtils.Event.SHEEP_CREATED.onEvent();
             }
         }
@@ -360,13 +356,13 @@ public class SheepApp extends MultiDexApplication {
         @Override
         public void onActivityStarted(Activity activity) {
             mActivityCount++;
-            if(!UMConfigUtils.isNotNeedAct(activity))
+            if (!UMConfigUtils.isNotNeedAct(activity))
                 UMConfigUtils.onPageStart(activity);
             if (mActivityCount > 0) {
                 if (!notStop) {
                     notStop = true;
                     LogUtil.println("SheepApp onActivityStarted", activity.getClass().getSimpleName(), mActivityCount);
-                    if(!UMConfigUtils.isNotNeedAct(activity))
+                    if (!UMConfigUtils.isNotNeedAct(activity))
                         UMConfigUtils.Event.SHEEP_STARTED.onEvent();
                     Jump2View.getInstance().startListenerShotService(activity);
                     Jump2View.getInstance().startShotScreenFloat(activity, false);
@@ -385,13 +381,13 @@ public class SheepApp extends MultiDexApplication {
         @Override
         public void onActivityStopped(Activity activity) {
             mActivityCount--;
-            if(!UMConfigUtils.isNotNeedAct(activity))
+            if (!UMConfigUtils.isNotNeedAct(activity))
                 UMConfigUtils.onPageEnd(activity);
             if (mActivityCount <= 0) {
                 if (notStop) {
                     notStop = false;
                     LogUtil.println("SheepApp onActivityStopped", activity.getClass().getSimpleName(), mActivityCount);
-                    if(!UMConfigUtils.isNotNeedAct(activity))
+                    if (!UMConfigUtils.isNotNeedAct(activity))
                         UMConfigUtils.Event.SHEEP_STOPPED.onEvent();
                     Jump2View.getInstance().startShotScreenFloat(activity, true);
                 }
@@ -418,7 +414,7 @@ public class SheepApp extends MultiDexApplication {
                 if (DataUtil.IS_USE_SCREEN_SHOT)
                     stopService(new Intent(SheepApp.this, FloatShotScreenService.class));
                 SpUtils.saveOrder("order", 1);
-                if(!UMConfigUtils.isNotNeedAct(activity))
+                if (!UMConfigUtils.isNotNeedAct(activity))
                     UMConfigUtils.Event.SHEEP_DESTROYED.onEvent();
             }
             ActivityManager.getInstance().endActivity(activity);