# flutter_phone **Repository Path**: slh_gitee/flutter_phone ## Basic Information - **Project Name**: flutter_phone - **Description**: 666666666666666666666 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-10-24 - **Last Updated**: 2023-01-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # flutter_phone A new Flutter plugin. ## Getting Started This project is a starting point for a Flutter [plug-in package](https://flutter.dev/developing-packages/), a specialized package that includes platform-specific implementation code for Android and/or iOS. For help getting started with Flutter, view our [online documentation](https://flutter.dev/docs), which offers tutorials, samples, guidance on mobile development, and a full API reference. # 实例代码 ``` # 监听来电 待测试 FlutterPhone.addPhoneListener((result) { print("监听信息"); // { // "type": "STATE_IDLE", // "name": "挂断", // "phone": "incomingNumber", // } print(result); }); # 获取手机卡槽信息 String jsonStr = await FlutterPhone.simInfo(); { "simCount": 2, //卡槽个数 "activeCount": 1,//使用个数 "simList": [{ //使用卡信息 "countryIso": "cn", "carrierName": "中国移动", "slotIndex": 0, //卡槽索引 "subscriptionId": 2 }] } # 拨打电话 /** *第一个参数 手机号 *isDirect:是否直接拨号 *slotIndex:卡槽索引 用来指定卡拨号 */ FlutterPhone.call("15136139162",isDirect: true,slotIndex: int.parse(simJson['simList'][0]['slotIndex'].toString())); # 获取联系人列表(分页) String? jsonStr = await FlutterPhone.getContacts(page, pageSize: 20); { "total": 184, "totalPage": 10, "list": [{ "name": "***", "phoneNumber": "00861557579823", "id": 1, "headUrl": "content:\/\/com.android.contacts\/contacts\/0" } ] } # 获取通话记录列表 String? jsonStr = await FlutterPhone.getAllCallRecords(); { "total": 950, "list": [{ "id": "984", "type": 2, "typeText": "呼出", "name": "中国移动通信", "phoneNumber": "10086", "cacheNumber": "10086", "duration": 0, "dateTimeMillis": 1666518103333, "dateString": "2022-10-23 17:41:43", "phoneAccountId": 1 }] # 根据手机号获取通话录音 String? jsonStr = await FlutterPhone.getCallRecordsAudioByPhoneNumber(widget.phoneNumber); [{ "id": 0, "filename": "杰@166 3165 0858_20221022170254.m4a", "duration": 73024, "size": 1368.54, "lastModified": 1666429447000, "path": "\/storage\/emulated\/0\/Sounds\/CallRecord\/杰@166 3165 0858_20221022170254.m4a" }] ```