|
|
@ -81,7 +81,7 @@ void onStart(ServiceInstance service) async {
|
|
|
|
flag = 0;
|
|
|
|
flag = 0;
|
|
|
|
// print("object");
|
|
|
|
// print("object");
|
|
|
|
final Iterable<CallLogEntry> entry = await CallLog.query();
|
|
|
|
final Iterable<CallLogEntry> entry = await CallLog.query();
|
|
|
|
phoneNum=entry.first.number;
|
|
|
|
phoneNum = entry.first.number;
|
|
|
|
callRecords = entry.first.duration;
|
|
|
|
callRecords = entry.first.duration;
|
|
|
|
// print(prefs.getString('action'));
|
|
|
|
// print(prefs.getString('action'));
|
|
|
|
// DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)
|
|
|
|
// DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)
|
|
|
@ -92,10 +92,10 @@ void onStart(ServiceInstance service) async {
|
|
|
|
// // }
|
|
|
|
// // }
|
|
|
|
// }else{
|
|
|
|
// }else{
|
|
|
|
// print("没接通");
|
|
|
|
// print("没接通");
|
|
|
|
if(callRecords!=0){
|
|
|
|
if (callRecords != 0) {
|
|
|
|
print("接通了");
|
|
|
|
print("接通了");
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
print("没接通");
|
|
|
|
print("没接通");
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
|
|
|
|
// if(kg!) {
|
|
|
|
// if(kg!) {
|
|
|
@ -114,9 +114,9 @@ void onStart(ServiceInstance service) async {
|
|
|
|
flag++;
|
|
|
|
flag++;
|
|
|
|
// print('flag $flag');
|
|
|
|
// print('flag $flag');
|
|
|
|
} else if (callState == "OFFHOOK") {
|
|
|
|
} else if (callState == "OFFHOOK") {
|
|
|
|
|
|
|
|
|
|
|
|
flag++;
|
|
|
|
flag++;
|
|
|
|
// print('flag $flag');
|
|
|
|
// print('flag $flag');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|