From 5c6aafe32dfd981ac729a4f213f80fac2db0efea Mon Sep 17 00:00:00 2001 From: datang Date: Wed, 24 Aug 2022 18:13:35 +0800 Subject: [PATCH] aaaa --- lib/ui/home/call.dart | 26 +++++++++++++------------- lib/ui/user/user_page.dart | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/ui/home/call.dart b/lib/ui/home/call.dart index 96db0e9..09a0199 100644 --- a/lib/ui/home/call.dart +++ b/lib/ui/home/call.dart @@ -81,21 +81,21 @@ void onStart(ServiceInstance service) async { flag = 0; // print("object"); final Iterable entry = await CallLog.query(); - phoneNum=entry.first.number; + phoneNum = entry.first.number; callRecords = entry.first.duration; // print(prefs.getString('action')); // DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!) // print('DURATION : ${entry.first.duration}');///通话时长 // if(callRecords!=0){ // // if(kg!){ - Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!); + Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!); // // } // }else{ // print("没接通"); - if(callRecords!=0){ + if (callRecords != 0) { print("接通了"); Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了"); - }else{ + } else { print("没接通"); Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了"); // if(kg!) { @@ -106,17 +106,17 @@ void onStart(ServiceInstance service) async { // // final inbox = telephony.getInboxSms(); // Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "啦啦啦啦啦"); // telephony.sendSms(to: phoneNum, message: "感谢来电"); - // _sendSMS('',[phoneNum]); + // _sendSMS('',[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'); } }); } diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index 21b56c8..8da82a2 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -2,6 +2,7 @@ import 'package:bot_toast/bot_toast.dart'; import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/ui/login/login_page.dart';