diff --git a/app/build.gradle b/app/build.gradle index 95181fb..8d847d3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,10 +15,10 @@ android { minSdkVersion 20 targetSdkVersion 29 - versionCode 147 - versionName "3.0.4"//测试jiaoguanyi.cn -// versionCode 129 -// versionName "2.0.0.9"// 正式jiaoguanyi.com 双数正式 单数测试 +// versionCode 148 +// versionName "3.0.5"//测试jiaoguanyi.cn + versionCode 1002 + versionName "2.0.1.2"// 正式jiaoguanyi.com 双数正式 单数测试 multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java b/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java index 53cf8bb..d2673b6 100644 --- a/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java +++ b/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java @@ -652,18 +652,22 @@ public class MainActivity extends AppCompatActivity { layout_class.setVisibility(View.GONE); } else { tv_class.setText(info.getBatch()); + layout_class.setVisibility(View.VISIBLE); + } if (info.getSno().equals("")) { tv_number.setText("暂无信息"); layout_number.setVisibility(View.GONE); } else { tv_number.setText(info.getSno()); + layout_number.setVisibility(View.VISIBLE); } if (info.getRealname().equals("")) { tv_name.setText("暂无信息"); layout_name.setVisibility(View.GONE); } else { tv_name.setText(info.getRealname()); + layout_name.setVisibility(View.VISIBLE); } } break; diff --git a/app/src/main/java/com/mjsheng/myappstore/network/Network.java b/app/src/main/java/com/mjsheng/myappstore/network/Network.java index 8f0ac0c..0d603c3 100644 --- a/app/src/main/java/com/mjsheng/myappstore/network/Network.java +++ b/app/src/main/java/com/mjsheng/myappstore/network/Network.java @@ -40,10 +40,10 @@ public class Network { // public static final String ROOT_URL = "http://www.as.xueshibao.com.cn/api/"; 弃用 // public static final String ROOT_URL = "https://www.jiaoguanyi.com/api/";//正式 弃用 -// public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式 -// public static final String WebsocketURL = "ws://47.107.133.19:1234"; - public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试 - public static final String WebsocketURL = "ws://47.107.133.19:2345"; + public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式 + public static final String WebsocketURL = "ws://47.107.133.19:1234"; +// public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试 +// public static final String WebsocketURL = "ws://47.107.133.19:2345"; private static UploadAppInfoApi uploadAppInfoApi; private static DeselectIDApi deselectIDApi; diff --git a/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java b/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java index e3d0f34..141a60a 100644 --- a/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java +++ b/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java @@ -105,6 +105,42 @@ public class MyJPushReceiver extends BroadcastReceiver { return 0; } + @Override + public void onReceive(Context context, Intent intent) { + mContext = context; + Bundle bundle = intent.getExtras(); + + if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) { + String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID); + Log.e(TAG, "[MyReceiver] 接收Registration Id : " + regId); + //send the Registration Id to your server... + } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) { + // ToastTool.show("[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE) + // + "---" + bundle.getString(JPushInterface.EXTRA_TITLE) + "---" + bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE) + // + "---" + bundle.getString(JPushInterface.EXTRA_EXTRA) + "----" + bundle.getString("package_name")); + // Log.e(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE) + // + "---" + bundle.getString(JPushInterface.EXTRA_TITLE) + "---" + bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE) + // + "---" + bundle.getString(JPushInterface.EXTRA_EXTRA) + "----" + bundle.getString("package_name")); + processCustomMessage(context, bundle);//屏蔽推送 + } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) { + Log.e(TAG, "[MyReceiver] 接收到推送下来的通知" + bundle.getString(JPushInterface.EXTRA_EXTRA)); + // doDownloadAndInstall(bundle.getString(JPushInterface.EXTRA_EXTRA)); + // LogUtils.e(getBatteryLevel()+"-0-iweroiwerewefeerer-----------"); + int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID); + Log.e(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId); + } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) { + Log.e(TAG, "[MyReceiver] 用户点击打开了通知"); + } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) { + Log.e(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA)); + //在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等.. + } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) { + boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false); + Log.e(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected); + } else { + Log.e(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction()); + } + } + private void processCustomMessage(final Context context, Bundle bundle) { String message = bundle.getString(JPushInterface.EXTRA_MESSAGE); String title = bundle.getString(JPushInterface.EXTRA_TITLE); @@ -178,15 +214,22 @@ public class MyJPushReceiver extends BroadcastReceiver { MyApplication.sendAppUsedTime(random, sendType); break; case GET_FORCEDOWNLOADURL: - com.alibaba.fastjson.JSONObject URI = JSON.parseObject(extras); - String versionCode = URI.getString("version_code"); - String url = URI.getString("url"); + if (TextUtils.isEmpty(extras)) { + Log.e("mjsheng", "settingNetControl extras is null"); + return; + } + com.alibaba.fastjson.JSONObject extra = JSON.parseObject(extras); + String app_name=extra.getString("app_name"); + String app_package=extra.getString("package"); + String url = extra.getString("url"); + int versionCode = extra.getInteger("version_code"); + com.alibaba.fastjson.JSONObject packageObj = new com.alibaba.fastjson.JSONObject(); - packageObj.put("app_name", "教管易"); - packageObj.put("app_package", "com.jiaoguanyi.store"); + packageObj.put("app_name", app_name); + packageObj.put("app_package", app_package); Aria.download(this) .load(url) //读取下载地址 - .setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.store") + ".apk", true) + .setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(url) + ".apk", true) .setExtendField(packageObj.toJSONString()) .create(); //启动下载} @@ -862,46 +905,7 @@ public class MyJPushReceiver extends BroadcastReceiver { } } - @Override - public void onReceive(Context context, Intent intent) { - mContext = context; - Bundle bundle = intent.getExtras(); - if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) { - String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID); - Log.e(TAG, "[MyReceiver] 接收Registration Id : " + regId); - //send the Registration Id to your server... - } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) { - // ToastTool.show("[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE) - // + "---" + bundle.getString(JPushInterface.EXTRA_TITLE) + "---" + bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE) - // + "---" + bundle.getString(JPushInterface.EXTRA_EXTRA) + "----" + bundle.getString("package_name")); - // Log.e(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE) - // + "---" + bundle.getString(JPushInterface.EXTRA_TITLE) + "---" + bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE) - // + "---" + bundle.getString(JPushInterface.EXTRA_EXTRA) + "----" + bundle.getString("package_name")); - processCustomMessage(context, bundle);//屏蔽推送 - } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) { - Log.e(TAG, "[MyReceiver] 接收到推送下来的通知" + bundle.getString(JPushInterface.EXTRA_EXTRA)); - // doDownloadAndInstall(bundle.getString(JPushInterface.EXTRA_EXTRA)); - // LogUtils.e(getBatteryLevel()+"-0-iweroiwerewefeerer-----------"); - int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID); - Log.e(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId); - - - } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) { - Log.e(TAG, "[MyReceiver] 用户点击打开了通知"); - - - } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) { - Log.e(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA)); - //在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等.. - - } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) { - boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false); - Log.e(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected); - } else { - Log.e(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction()); - } - } public void settingLock(String s) { if (TextUtils.isEmpty(s)) { diff --git a/app/src/main/java/com/mjsheng/myappstore/server/StepService.java b/app/src/main/java/com/mjsheng/myappstore/server/StepService.java index 8c13724..f6f745e 100644 --- a/app/src/main/java/com/mjsheng/myappstore/server/StepService.java +++ b/app/src/main/java/com/mjsheng/myappstore/server/StepService.java @@ -130,6 +130,8 @@ public class StepService extends Service { public void onClose(int code, String reason, boolean remote) { super.onClose(code, reason, remote); Log.i("JWebSocketClientService", "websocket连接关闭"); + client = null; + initSocketClient(); mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测 } @@ -138,6 +140,8 @@ public class StepService extends Service { public void onError(Exception ex) { super.onError(ex); Log.i("JWebSocketClientService", "websocket连接错误"); + client = null; + initSocketClient(); mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测 } diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index f846058..2842f1d 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -62,8 +62,8 @@ android:id="@+id/linearLayout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="12dp" android:layout_marginLeft="@dimen/dp_150" + android:layout_marginTop="12dp" android:layout_marginRight="@dimen/dp_150" android:orientation="vertical" app:layout_constraintEnd_toEndOf="parent" @@ -73,8 +73,7 @@ + android:layout_height="@dimen/dp_20"> + + android:layout_height="@dimen/dp_20"> + + android:layout_height="@dimen/dp_20"> + + android:visibility="gone"> + + android:visibility="gone"> + + android:visibility="gone"> + - - +