import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.provider.ICDatabaseHelper;
+import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
import com.enqualcomm.support.provider.ICNotificationProvider;
import com.enqualcomm.support.service.AudioService;
import com.enqualcomm.support.service.Deliver;
}
}
}
-
}
+
private void updateMsgSettingsValue() {
ContentValues contentValues = new ContentValues();
//分类是心率的包名
//1表示有,0表示没有
contentValues.put(ICDatabaseHelper.sValue, 1);
ContentResolver resolver = runtime.getContextProxy().getResolver();
- resolver.insert(Uri.parse(ICNotificationProvider.NOTIFICATIONS), contentValues);
+ resolver.insert(Uri.parse(ICGlobalSettingsProvider.SETTINGS), contentValues);
}
private void createNotification(String title, String type) {
}
sendSMS(cell_number_to_reply, "http://maps.google.com/?q=" + locationResponseUrl);
cell_number_to_reply = "";
-
}
}
import android.provider.CallLog;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
+import android.text.TextUtils;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.ICNotificationProvider;
public class PhoneCallListener extends PhoneStateListener {
private final Context mContext;
+ private String mLastPhoneNumber;
public PhoneCallListener(Context context) {
this.mContext = context;
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
ICLogger.d("state == > " + state + " incomingNumber ==> " + incomingNumber);
+ if (!TextUtils.isEmpty(incomingNumber)) {
+ this.mLastPhoneNumber = incomingNumber;
+ }
//挂断的时候,去查询一下是不是未接电话即可
if (state == CALL_STATE_IDLE) {
//去查询是否有未接电话
- queryCallState();
+ queryCallState(this.mLastPhoneNumber);
}
}
- private void queryCallState() {
+ private void queryCallState(String phoneNum) {
+ if (TextUtils.isEmpty(phoneNum)) {
+ return;
+ }
String[] projection = {
CallLog.Calls.NUMBER,
CallLog.Calls.TYPE
};
- String where = CallLog.Calls.TYPE + "=" + CallLog.Calls.MISSED_TYPE;
+ String where = CallLog.Calls.TYPE + "=" + CallLog.Calls.MISSED_TYPE + " and " +
+ CallLog.Calls.NUMBER + "=" + phoneNum;
Cursor c = mContext.getContentResolver().query(
Uri.parse("content://call_log/calls"),
projection,
null,
null
);
+ ICLogger.d("where is == > " + where);
if (c != null) {
if (c.moveToNext()) {
- String phoneNum = c.getString(0);
//创建通知,如果大于1的知,说明有未接电话
createNotification(phoneNum);
//修改顶部的状态
}
private void createNotification(String phoneNum) {
+ ICLogger.d("createNotification==> " + phoneNum);
ContentValues contentValues = new ContentValues();
//分类是心率的包名
contentValues.put(ICDatabaseHelper.notification_category, "com.ic.phone");