import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import static com.enqualcomm.support.Constants.ACTION_TINTERNAL_TEST;
import static com.enqualcomm.support.Constants.FROM_SERVER;
import static com.enqualcomm.support.Constants.KeyReplyData;
+import static com.enqualcomm.support.provider.ICMembersProvider.MEMBERS;
import static com.enqualcomm.support.utils.SimSignalUtil.send_at_cmd;
import static com.enqualcomm.support.utils.SimSignalUtil.send_at_setImei0;
resolver.insert(Uri.parse(ICGlobalSettingsProvider.SETTINGS), contentValues);
}
- private void createNotification(String title, String type) {
+
+ private String parsePhoneNumName(String phoneNumber) {
+ Cursor query = mContext.getContentResolver().query(Uri.parse(MEMBERS),
+ new String[]{"user_name"}, "phone_num=?",
+ new String[]{phoneNumber}, null);
+ StringBuilder targetName = new StringBuilder();
+ if (query != null) {
+ int count = query.getCount();
+ ICLogger.d("count ==> " + count);
+ while (query.moveToNext()) {
+ targetName.append(query.getString(0));
+ if (count > 1) {
+ targetName.append("|");
+ }
+ count--;
+ }
+ query.close();
+ return targetName.toString();
+ }
+ return null;
+ }
+
+
+ private void createNotification(String phoneNum, String type) {
+ String name = parsePhoneNumName(phoneNum);
+ String targetDisplay = phoneNum;
+ if (!TextUtils.isEmpty(name)) {
+ targetDisplay = name + "(" + phoneNum + ")";
+ }
ContentValues contentValues = new ContentValues();
contentValues.put(ICDatabaseHelper.notification_category, "com.ic.mms");
- contentValues.put(ICDatabaseHelper.notification_title, title);
+ contentValues.put(ICDatabaseHelper.notification_title, targetDisplay);
contentValues.put(ICDatabaseHelper.notification_type, type);
contentValues.put(ICDatabaseHelper.notification_date, System.currentTimeMillis());
contentValues.put(ICDatabaseHelper.notification_order, 0);
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
+import android.text.TextUtils;
import android.util.Log;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.ICNotificationProvider;
import static com.enqualcomm.support.provider.ICGlobalSettingsProvider.SETTINGS;
+import static com.enqualcomm.support.provider.ICMembersProvider.MEMBERS;
/**
* 监听电话数据库的状态
resolver.insert(Uri.parse(SETTINGS), values);
}
+
+ private String parsePhoneNumName(String phoneNumber) {
+ Cursor query = mContext.getContentResolver().query(Uri.parse(MEMBERS),
+ new String[]{"user_name"}, "phone_num=?",
+ new String[]{phoneNumber}, null);
+ StringBuilder targetName = new StringBuilder();
+ if (query != null) {
+ int count = query.getCount();
+ Log.d(TAG, "count ==> " + count);
+ while (query.moveToNext()) {
+ targetName.append(query.getString(0));
+ if (count > 1) {
+ targetName.append("|");
+ }
+ count--;
+ }
+ query.close();
+ return targetName.toString();
+ }
+ return null;
+ }
+
+
private void createNotification(String phoneNum) {
Log.d(TAG, "createNotification ===> " + phoneNum);
+ //解析一下电话名称
+ String targetName = parsePhoneNumName(phoneNum);
+ String displayItem = phoneNum;
+ if (!TextUtils.isEmpty(targetName)) {
+ displayItem = targetName + "(" + displayItem + ")";
+ }
+ Log.d(TAG, "createNotification = displayItem ==> " + displayItem);
//先查询是否有,如果已经有的话,就不创建了
Cursor query = mContext.getContentResolver().query(Uri.parse(ICNotificationProvider.NOTIFICATIONS),
null, "category=? and type=? and title=?",
Log.d(TAG, "createNotification==> " + phoneNum);
ContentValues contentValues = new ContentValues();
contentValues.put(ICDatabaseHelper.notification_category, "com.ic.phone");
- contentValues.put(ICDatabaseHelper.notification_title, phoneNum);
+ contentValues.put(ICDatabaseHelper.notification_title, displayItem);
contentValues.put(ICDatabaseHelper.notification_type, "missed_phone");
contentValues.put(ICDatabaseHelper.notification_date, System.currentTimeMillis());
contentValues.put(ICDatabaseHelper.notification_order, 0);
-#Fri Sep 03 16:07:29 CST 2021\r
-VERSION_CODE=942\r
+#Fri Sep 03 16:14:44 CST 2021\r
+VERSION_CODE=943\r