|
|
@ -63,42 +63,18 @@ void onStart(ServiceInstance service) async {
|
|
|
|
print(callState+"$flag");
|
|
|
|
print(callState+"$flag");
|
|
|
|
String? ref = prefs.getString('refSms');
|
|
|
|
String? ref = prefs.getString('refSms');
|
|
|
|
String? con = prefs.getString('conSms');
|
|
|
|
String? con = prefs.getString('conSms');
|
|
|
|
|
|
|
|
print(con);
|
|
|
|
|
|
|
|
|
|
|
|
if (callState == "IDLE") {
|
|
|
|
if (callState == "IDLE") {
|
|
|
|
if (flag != 0) {
|
|
|
|
if (flag != 0) {
|
|
|
|
// 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'));
|
|
|
|
|
|
|
|
// DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)
|
|
|
|
|
|
|
|
// print('DURATION : ${entry.first.duration}');///通话时长
|
|
|
|
|
|
|
|
// if(callRecords!=0){
|
|
|
|
|
|
|
|
// // if(kg!){
|
|
|
|
|
|
|
|
if (flag > 0) {
|
|
|
|
if (flag > 0) {
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: con!);
|
|
|
|
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: con!);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// print("没接通");
|
|
|
|
|
|
|
|
// if (callRecords != 0) {
|
|
|
|
|
|
|
|
// print("接通了");
|
|
|
|
|
|
|
|
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// print("没接通");
|
|
|
|
|
|
|
|
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
|
|
|
|
|
|
|
|
// if(kg!) {
|
|
|
|
|
|
|
|
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "没接通");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// print('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)}');//拨通时间
|
|
|
|
|
|
|
|
// print("你好$phoneNum");
|
|
|
|
|
|
|
|
// // final inbox = telephony.getInboxSms();
|
|
|
|
|
|
|
|
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "啦啦啦啦啦");
|
|
|
|
|
|
|
|
// telephony.sendSms(to: phoneNum, message: "感谢来电");
|
|
|
|
|
|
|
|
// _sendSMS('',[phoneNum]);
|
|
|
|
|
|
|
|
// print("你好123123$phoneNum");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
flag = 0;
|
|
|
|
flag = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (callState == "RINGING") {
|
|
|
|
} else if (callState == "RINGING") {
|
|
|
|