master
戴余标 2 years ago
parent 70723dcdb6
commit 5c6aafe32d

@ -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');
} }
}); });
} }

@ -2,6 +2,7 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/login/login_page.dart'; import 'package:project_telephony/ui/login/login_page.dart';

Loading…
Cancel
Save