From: TrillGates Date: Sat, 17 Jul 2021 12:11:57 +0000 (+0800) Subject: s123 protocol sms not show dialog but create notification. X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=a67ec9eb95ca73cdcfbd33786fbf27f683b98000;p=protocol_srv.git s123 protocol sms not show dialog but create notification. --- diff --git a/app/release/ICSer_V892_2107162040_release.apk b/app/release/ICSer_V893_2107171959_release.apk similarity index 75% rename from app/release/ICSer_V892_2107162040_release.apk rename to app/release/ICSer_V893_2107171959_release.apk index ab777c8b..3951fbdb 100644 Binary files a/app/release/ICSer_V892_2107162040_release.apk and b/app/release/ICSer_V893_2107171959_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 034e6583..9d8ee179 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":892,"versionName":"2107162040","enabled":true,"outputFile":"ICSer_V892_2107162040_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V892_2107162040_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":893,"versionName":"2107171959","enabled":true,"outputFile":"ICSer_V893_2107171959_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V893_2107171959_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/ICSmsManager.java b/app/src/main/java/com/enqualcomm/support/ICSmsManager.java index 7e668a88..20306875 100644 --- a/app/src/main/java/com/enqualcomm/support/ICSmsManager.java +++ b/app/src/main/java/com/enqualcomm/support/ICSmsManager.java @@ -3,6 +3,8 @@ package com.enqualcomm.support; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.ComponentName; +import android.content.ContentResolver; +import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; @@ -20,6 +22,8 @@ import com.enqualcomm.support.bean.Contact; import com.enqualcomm.support.bean.ICLocation; import com.enqualcomm.support.bean.Runtime; import com.enqualcomm.support.bean.StringMessage; +import com.enqualcomm.support.provider.ICDatabaseHelper; +import com.enqualcomm.support.provider.ICNotificationProvider; import com.enqualcomm.support.service.AudioService; import com.enqualcomm.support.service.Deliver; import com.enqualcomm.support.service.HeartRateManager; @@ -50,6 +54,7 @@ import java.util.List; import chestnut.utils.PhoneUtils; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; +import static com.enqualcomm.support.Config.PROTOCOL_S123; import static com.enqualcomm.support.Constants.ACTION_SMSCMD; import static com.enqualcomm.support.Constants.ACTION_SMSCMD_Reply; import static com.enqualcomm.support.Constants.ACTION_SMSCMD_TEST; @@ -121,18 +126,33 @@ public class ICSmsManager extends BroadcastReceiver { //判断是否要弹窗,强制读取 String forceReadMsg = Util.getSystemProperties("persist.sys.forcereadmsg"); ICLogger.d("forceReadMsg == > " + forceReadMsg); - if (handleSMS_CMD(from, message) == false) { + if (!handleSMS_CMD(from, message)) { //说明不是sms命令,提示短信接收。 if (!TextUtils.isEmpty(forceReadMsg)) { WakeLockUtil.ScreenOnWakeLockTemperary(context); ContextProxy.play_waning_notify(context); VibrateUtil.getInstance(context).VibrateOnOnce(true); Util.mSleep(2000); - MsgMustReadDialog instance = MsgMustReadDialog.getInstance(); - instance.showMsgDialog(); - List list = new ArrayList<>(); - list.add(message); - instance.addData(list); + //add by TrillGates=======start + //弹出提示窗口,如果是S123的话,就不弹出了 + //因为S123有特定的短信提示,创建对应的notification即可 + //只要: + //1.插入一条通知内容 + //2.写入一个设置状态,Launcher顶部显示短信图标。如果短信打开,则会把此标记置成0 + //表示已经读 + if (Config.protocol_no == PROTOCOL_S123) { + createNotification(from, "sms"); + //修改设置项 + updateMsgSettingsValue(); + } else { + //其他的照样弹窗 + //add by TrillGates=======end + MsgMustReadDialog instance = MsgMustReadDialog.getInstance(); + instance.showMsgDialog(); + List list = new ArrayList<>(); + list.add(message); + instance.addData(list); + } } else { //说明不是sms命令,提示短信接收。 ContextProxy.sendMsgBroadcast(context, message, 1); @@ -142,6 +162,29 @@ public class ICSmsManager extends BroadcastReceiver { } + private void updateMsgSettingsValue() { + ContentValues contentValues = new ContentValues(); + //分类是心率的包名 + contentValues.put(ICDatabaseHelper.sKey, "sms_unread"); + //1表示有,0表示没有 + contentValues.put(ICDatabaseHelper.sValue, 1); + ContentResolver resolver = runtime.getContextProxy().getResolver(); + resolver.insert(Uri.parse(ICNotificationProvider.NOTIFICATIONS), contentValues); + } + + private void createNotification(String title, String type) { + ContentValues contentValues = new ContentValues(); + //分类是心率的包名 + contentValues.put(ICDatabaseHelper.notification_category, "com.ic.mms"); + contentValues.put(ICDatabaseHelper.notification_title, title); + contentValues.put(ICDatabaseHelper.notification_type, type); + contentValues.put(ICDatabaseHelper.notification_date, System.currentTimeMillis()); + contentValues.put(ICDatabaseHelper.notification_order, 0); + contentValues.put(ICDatabaseHelper.notification_create_time, System.currentTimeMillis()); + ContentResolver resolver = runtime.getContextProxy().getResolver(); + resolver.insert(Uri.parse(ICNotificationProvider.NOTIFICATIONS), contentValues); + } + public class ReplayLocation implements LocationClient.LocationResponseUrl { @Override @@ -842,7 +885,7 @@ public class ICSmsManager extends BroadcastReceiver { /* #setLogSrv#=http://icfota.snicker.com.cn:8089/UploadFile.jsp*/ Config.setHttpLogServerUrl(mContext, strtmp); sendSMS(phonenumber, "set setLogSrv to " + strtmp + "!"); - }else { + } else { sendSMS(phonenumber, " setLogSrv cmd Format error!"); } diff --git a/app/version_code.properties b/app/version_code.properties index dc859b75..47cfbaca 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Fri Jul 16 20:40:08 CST 2021 -VERSION_CODE=892 +#Sat Jul 17 19:59:31 CST 2021 +VERSION_CODE=893