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;
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;
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;
//判断是否要弹窗,强制读取
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<String> 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<String> list = new ArrayList<>();
+ list.add(message);
+ instance.addData(list);
+ }
} else {
//说明不是sms命令,提示短信接收。
ContextProxy.sendMsgBroadcast(context, message, 1);
}
+ 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
/* #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!");
}