|
|
@ -81,21 +81,21 @@ 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!)
|
|
|
|
// print('DURATION : ${entry.first.duration}');///通话时长
|
|
|
|
// print('DURATION : ${entry.first.duration}');///通话时长
|
|
|
|
// if(callRecords!=0){
|
|
|
|
// if(callRecords!=0){
|
|
|
|
// // if(kg!){
|
|
|
|
// // if(kg!){
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);
|
|
|
|
// // }
|
|
|
|
// // }
|
|
|
|
// }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!) {
|
|
|
@ -106,17 +106,17 @@ void onStart(ServiceInstance service) async {
|
|
|
|
// // final inbox = telephony.getInboxSms();
|
|
|
|
// // final inbox = telephony.getInboxSms();
|
|
|
|
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "啦啦啦啦啦");
|
|
|
|
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "啦啦啦啦啦");
|
|
|
|
// telephony.sendSms(to: phoneNum, message: "感谢来电");
|
|
|
|
// telephony.sendSms(to: phoneNum, message: "感谢来电");
|
|
|
|
// _sendSMS('',[phoneNum]);
|
|
|
|
// _sendSMS('',[phoneNum]);
|
|
|
|
// print("你好123123$phoneNum");
|
|
|
|
// print("你好123123$phoneNum");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (callState == "RINGING") {
|
|
|
|
|
|
|
|
flag++;
|
|
|
|
|
|
|
|
// print('flag $flag');
|
|
|
|
|
|
|
|
} else if (callState == "OFFHOOK") {
|
|
|
|
|
|
|
|
flag++;
|
|
|
|
|
|
|
|
// print('flag $flag');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (callState == "RINGING") {
|
|
|
|
|
|
|
|
flag++;
|
|
|
|
|
|
|
|
// print('flag $flag');
|
|
|
|
|
|
|
|
} else if (callState == "OFFHOOK") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flag++;
|
|
|
|
|
|
|
|
// print('flag $flag');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|