You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.1 KiB
63 lines
2.1 KiB
//
|
|
//
|
|
// import 'dart:async';
|
|
//
|
|
// import 'package:call_log/call_log.dart';
|
|
// import 'package:flutter_sms/flutter_sms.dart';
|
|
// import 'package:get/get_utils/get_utils.dart';
|
|
// import 'package:telephony/telephony.dart';
|
|
// import 'package:workmanager/workmanager.dart';
|
|
//
|
|
// import '../user/user_page.dart';
|
|
// Future<void> _sendSMS(String message, List<String> recipients) async {
|
|
// // await sendSMS(message: message, recipients: recipients, sendDirect: true);
|
|
// try{
|
|
// String result =
|
|
// await sendSMS(message: message, recipients: recipients, sendDirect: true);
|
|
// print(result);
|
|
// } catch (error){
|
|
// print(error.toString());
|
|
// }
|
|
//
|
|
// }
|
|
// void callbackDispatcher() {
|
|
// Workmanager().executeTask((task, inputData) async{
|
|
// // _sendSMS("感谢来电", ["13486828191"]);
|
|
// // ${Telephony.backgroundInstance.sendSms(to: "13486828191", message: "message")}
|
|
// print("123412312412312312431231231231231231313123:${ _sendSMS("感谢来电", ["13486828191"])}");
|
|
// await sendSMS(message: "感谢来电", recipients: ["1348å6828191"], sendDirect: true);
|
|
// // sms();//simpleTask will be emitted here.
|
|
// return Future.value(true);
|
|
// });
|
|
// }
|
|
// void sms() async{
|
|
// int flag = 0;
|
|
// String phoneNum="";
|
|
// String callState;
|
|
// CallState state = await Telephony.instance.callState;
|
|
// callState = state.name;
|
|
// // print(callState!+" $flag");
|
|
// if (callState == "IDLE") {
|
|
// if (flag != 0) {
|
|
// flag = 0;
|
|
// // print("object");
|
|
// final Iterable<CallLogEntry> result = await CallLog.query();
|
|
// phoneNum = result.first.number!;
|
|
// if(phoneNum.isEmpty){
|
|
// print("At Least 1 Person or Message Required");
|
|
// }else{
|
|
// print("你好$phoneNum");
|
|
// // telephony.sendSms(to: phoneNum, message: "1234");
|
|
// _sendSMS('感谢来电',[phoneNum]);
|
|
// // print("你好123123$phoneNum");
|
|
// }
|
|
// }
|
|
// } else if (callState == "RINGING") {
|
|
// flag++;
|
|
// print('flag $flag');
|
|
// } else if (callState == "OFFHOOK") {
|
|
// flag++;
|
|
// print('flag $flag');
|
|
// }
|
|
//
|
|
// } |