4q-s-r-o / call_log Goto Github PK
View Code? Open in Web Editor NEWA Flutter plugin to access and query call history log
License: MIT License
A Flutter plugin to access and query call history log
License: MIT License
I/flutter (25293): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (25293): The following RangeError was thrown building MyApp(dirty, state: _MyAppState#de240):
I/flutter (25293): RangeError (index): Invalid value: Not in range 0..6, inclusive: -2
I/flutter (25293):
I/flutter (25293): When the exception was thrown, this was the stack:
I/flutter (25293): #0 List.[] (dart:core-patch/array.dart:161:52)
I/flutter (25293): #1 new CallLogEntry.fromMap (package:call_log/call_log.dart:67:31)
I/flutter (25293): #2 CallLog.query. (package:call_log/call_log.dart:41:45)
I/flutter (25293): #3 MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
I/flutter (25293): #4 ListIterable.forEach (dart:_internal/iterable.dart:39:14)
I/flutter (25293): #5 _MyAppState.build (package:call_log_example/main.dart:17:21)
I/flutter (25293): #6 StatefulElement.build (package:flutter/src/widgets/framework.dart:3825:27)
I/flutter (25293): #7 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3739:15)
I/flutter (25293): #8 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter (25293): #9 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2278:33)
I/flutter (25293): #10 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:700:20)
I/flutter (25293): #11 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
I/flutter (25293): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1012:15)
I/flutter (25293): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:952:9)
I/flutter (25293): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:864:5)
I/flutter (25293): #18 _invoke (dart:ui/hooks.dart:219:10)
I/flutter (25293): #19 _drawFrame (dart:ui/hooks.dart:178:3)
I/flutter (25293): (elided 3 frames from package dart:async)
I/flutter (25293): ════════════════════════════════════════════════════════════════════════════════════════════════════
Hi, thank you for providing this plugin. Isn't READ_CALL_LOG forbidden for Google Play apps unless it's a Dialer app? It's not an issue with the library directly, but I am interested how / if you solve this in practice? I want to make (and have made) a personal call "CRM" for my business, but this stopped me in my tracks. I would love to redo it in flutter if it would be possible to use then.
Is the only solution to distribute it without Google Play, to recreate the Dialer app, or is there any other better way?
Thank you again. If this is not a proper place to ask this you can delete it or make it solved.
Janko
I'm able to get CallLog in Foreground with the call_log pub package. But I need to get Call Log in Background.
Here is some neccesery part of my code:
void main() {
runApp(MaterialApp(
home: Home(),
));
Workmanager.initialize(callbackDispatcher, isInDebugMode: true);
Workmanager.registerPeriodicTask("1", "simplePeriodicTask",
existingWorkPolicy: ExistingWorkPolicy.replace,
frequency: Duration(minutes: 15),
initialDelay:
Duration(seconds: 5),
constraints: Constraints(
networkType: NetworkType.connected,
));
}
void callbackDispatcher() {
Workmanager.executeTask((task, inputData) async{
await _HomeState().callLogDbManager();
print('Background Services are Working!');
return Future.value(true);
});
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
Future<void> callLogDbManager() async {
Iterable<CallLogEntry> cLog = await CallLog.get();
int rowCount = await DatabaseHelper.instance.queryRowCount();
int clLength = cLog.length;
if (rowCount >= clLength) {
callLogDbUpdate();
} else {
await callLogDbInsert();
callLogDbUpdate();
}
}
.......
.......
}
And this is the Error during getting call log in Background:
error, Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference, null
If I just want READ_CALL_LOG, but not READ_PHONE_STATE permission, is it possible?
From:
String[] perm = {Manifest.permission.READ_CALL_LOG, Manifest.permission.READ_PHONE_STATE};
To:
String[] perm = {Manifest.permission.READ_CALL_LOG};
Is there any way of getting distinct call logs from the list? for eg.
if I call one person 10 times, the first 10 entries are the same, but what if I only want one instance of their contact? what can we do in such cases?
How can I convert the integer timestamp to get the date and time of call?
I am trying to get call log for specific numbers. So i tried to use CallLog.query(number: "05530751438")
but it returning me 0 entry. And if i make this query with name like this await CallLog.query(name: "Ahmet Bugra Ozcan");
it returns me 2 entries. Number and name belong to the same person. I tried it with different numbers and names and tried it in real device.
Here is my code
final Iterable<CallLogEntry> result = await CallLog.query(name: "Ahmet Bugra Ozcan");
final Iterable<CallLogEntry> result2 = await CallLog.query(number: "05530751438");
print("Query with name : " + result.length.toString());
print("Query with number : " + result2.length.toString());
And my console
D/flutter/CALL_LOG(20853): onMethodCall
D/flutter/CALL_LOG(20853): onMethodCall
I/flutter (20853): Query with name : 2
I/flutter (20853): Query with number : 0
The example crashes when I tap on the get all button on Android.
D/ViewRootImpl( 7709): ViewPostImeInputStage ACTION_DOWN
E/flutter ( 7709): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(40)] java.lang.NoSuchMethodError: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar)
E/flutter ( 7709): at sk.fourq.calllog.CallLogPlugin.onMethodCall(CallLogPlugin.java:52)
E/flutter ( 7709): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
E/flutter ( 7709): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:88)
E/flutter ( 7709): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
E/flutter ( 7709): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 7709): at android.os.MessageQueue.next(MessageQueue.java:143)
E/flutter ( 7709): at android.os.Looper.loop(Looper.java:130)
E/flutter ( 7709): at android.app.ActivityThread.main(ActivityThread.java:6934)
E/flutter ( 7709): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 7709): at java.lang.reflect.Method.invoke(Method.java:372)
E/flutter ( 7709): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
E/flutter ( 7709): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
E/flutter ( 7709):
F/flutter ( 7709): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env).
F/libc ( 7709): Fatal signal 6 (SIGABRT), code -6 in tid 7709 (.calllogexample)
Build fingerprint: 'samsung/j1mini3gxw/j1mini3gxw:5.1.1/LMY47V/J105HXWU0ARD1:user/release-keys'
Revision: '2'
ABI: 'arm'
pid: 7709, tid: 7709, name: .calllogexample >>> sk.fourq.calllogexample <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env).
'
r0 00000000 r1 00001e1d r2 00000006 r3 00000000
r4 b6f3be38 r5 00000006 r6 0000000b r7 0000010c
r8 becefdc4 r9 00000004 sl 00000001 fp a1868208
ip 00001e1d sp becefca8 lr b6d94735 pc b6db7f5c cpsr 600e0010
backtrace:
#00 pc 0003af5c /system/lib/libc.so (tgkill+12)
#1 pc 00017731 /system/lib/libc.so (pthread_kill+52)
#2 pc 00018347 /system/lib/libc.so (raise+10)
#3 pc 00014be1 /system/lib/libc.so (__libc_android_abort+36)
#4 pc 00012f70 /system/lib/libc.so (abort+4)
#5 pc 0002f157 /data/app/sk.fourq.calllogexample-2/lib/arm/libflutter.so
#6 pc 000257c9 /data/app/sk.fourq.calllogexample-2/lib/arm/libflutter.so
#7 pc 00024c29 /data/app/sk.fourq.calllogexample-2/lib/arm/libflutter.so
#8 pc 0005629d /data/app/sk.fourq.calllogexample-2/lib/arm/libflutter.so
#9 pc 00030339 /data/app/sk.fourq.calllogexample-2/lib/arm/libflutter.so
#10 pc 00031835 /data/app/sk.fourq.calllogexample-2/lib/arm/libflutter.so
#11 pc 00011aa7 /system/lib/libutils.so (_ZN7android20SimpleLooperCallback11handleEventEiiPv+10)
#12 pc 00012709 /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+484)
#13 pc 000127b1 /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+92)
#14 pc 00088a45 /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvi+22)
#15 pc 000b6fe3 /system/framework/arm/boot.oat
Tombstone written to: /data/tombstones/tombstone_08
[✓] Flutter (Channel beta, v1.3.8, on Linux, locale fr_FR.UTF-8)
• Flutter version 1.3.8 at /home/me/bin/flutter/flutter
• Framework revision e5b1ed7a7f (il y a 3 semaines), 2019-03-06 14:23:37 -0800
• Engine revision f4951df193
• Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/me/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /home/me/Android/Sdk
• Java binary at: /home/me/bin/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.3)
• Android Studio at /home/me/bin/android-studio
• Flutter plugin version 33.3.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
I am working on a default phone app for android and my application is getting rejected because this plugin adding READ_CALL_LOG permission request in the manifest by default, if m application doesn't want to ask for permissions to the user then in my application I can set check permission automatic flag as false.
Currently, as the document suggests This plugin is able to handle checking and requesting permission automatically
. I am not able to remove the READ_CALL_LOG permission.
I have this log:
D/flutter/CALL_LOG( 1232): onMethodCall V/MiuiFrameworkFactory( 1232): get AllImpl object = android.common.MiuiFrameworkFactoryImpl@4e61412 W/MirrorManager( 1232): this model don't Support 3 D/flutter/CALL_LOG( 1232): onMethodCall W/Activity( 1232): Can request only one set of permissions at a time E/MethodChannel#sk.fourq.call_log( 1232): Failed to handle method call E/MethodChannel#sk.fourq.call_log( 1232): java.lang.IllegalStateException: Reply already submitted E/MethodChannel#sk.fourq.call_log( 1232): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:435) E/MethodChannel#sk.fourq.call_log( 1232): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:268) E/MethodChannel#sk.fourq.call_log( 1232): at sk.fourq.calllog.CallLogPlugin.queryLogs(CallLogPlugin.java:234) E/MethodChannel#sk.fourq.call_log( 1232): at sk.fourq.calllog.CallLogPlugin.handleMethodCall(CallLogPlugin.java:189) E/MethodChannel#sk.fourq.call_log( 1232): at sk.fourq.calllog.CallLogPlugin.onRequestPermissionsResult(CallLogPlugin.java:144) E/MethodChannel#sk.fourq.call_log( 1232): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:781) E/MethodChannel#sk.fourq.call_log( 1232): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:413) E/MethodChannel#sk.fourq.call_log( 1232): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:820) E/MethodChannel#sk.fourq.call_log( 1232): at io.flutter.embedding.android.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:941) E/MethodChannel#sk.fourq.call_log( 1232): at android.app.Activity.requestPermissions(Activity.java:5338) E/MethodChannel#sk.fourq.call_log( 1232): at androidx.core.app.ActivityCompat$Api23Impl.requestPermissions(ActivityCompat.java:893) E/MethodChannel#sk.fourq.call_log( 1232): at androidx.core.app.ActivityCompat.requestPermissions(ActivityCompat.java:557) E/MethodChannel#sk.fourq.call_log( 1232): at sk.fourq.calllog.CallLogPlugin.onMethodCall(CallLogPlugin.java:127) E/MethodChannel#sk.fourq.call_log( 1232): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
Everything works great on the above android versions but throws platform exception when I query logs in android 6.0.1 (Nexus 5).
Code:
int from = DateTime(date.year, date.month, date.day, 0).millisecondsSinceEpoch;
int to = DateTime(date.year, date.month, date.day, 24).millisecondsSinceEpoch;
List _logs = [];
logs = await CL.CallLog.query(dateFrom: from, dateTo: to, type: CallType.incoming);
Logs:
E/flutter ( 5842): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(INTERNAL_ERROR, Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference, null, null)
E/flutter ( 5842): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
E/flutter ( 5842): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
E/flutter ( 5842):
E/flutter ( 5842): #2 CallLog.query (package:call_log/call_log.dart:54:9)
E/flutter ( 5842):
E/flutter ( 5842): #3 LogEntity.query (package:broadcast_receiver/models/log_entity.dart:35:14)
E/flutter ( 5842):
E/flutter ( 5842): #4 HomeController.updateLogs (package:broadcast_receiver/controllers/home.dart:73:5)
E/flutter ( 5842):
E/flutter ( 5842): #5 HomeController.updateSelectedDate (package:broadcast_receiver/controllers/home.dart:94:7)
E/flutter ( 5842):
E/flutter ( 5842): #6 DatePicker.build. (package:broadcast_receiver/views/custom_widgets/date_picker.dart:17:9)
E/flutter ( 5842):
E/flutter ( 5842):
The error messages are as below when I run the code on Android device with Android Version 5.1.
E/flutter ( 5440): [ERROR:flutter/shell/platform/android/platform_view_android_jni_impl.cc(43)] java.lang.NoSuchMethodError: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/content/Context; or its super classes (declaration of 'android.content.Context' appears in /system/framework/framework.jar)
E/flutter ( 5440): at sk.fourq.calllog.CallLogPlugin.hasPermissions(CallLogPlugin.java:68)
E/flutter ( 5440): at sk.fourq.calllog.CallLogPlugin.onMethodCall(CallLogPlugin.java:55)
E/flutter ( 5440): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter ( 5440): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter ( 5440): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/flutter ( 5440): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 5440): at android.os.MessageQueue.next(MessageQueue.java:143)
E/flutter ( 5440): at android.os.Looper.loop(Looper.java:122)
E/flutter ( 5440): at android.app.ActivityThread.main(ActivityThread.java:5254)
E/flutter ( 5440): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 5440): at java.lang.reflect.Method.invoke(Method.java:372)
E/flutter ( 5440): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/flutter ( 5440): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
E/flutter ( 5440):
F/flutter ( 5440): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(942)] Check failed: CheckException(env).
Android 6.0 and above works fine.
While building apk I am getting the following error on the console,
Note: /Users/.../FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/call_log-3.0.3/android/src/main/java/sk/fourq/calllog/CallLogPlugin.java uses or overrides a deprecated API.
although the app builds successfully also I can run the app on the device.
Hi, strange issue, only first three call entries show null numbers. Did you hit this issue before?
I use the plugin in my flutter project
It is very good working on runtime
but I want to run this plugin on background service
İt give this error
Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference
Name/Display Name in call log entry is always same for both SIM cards even I have different SIM cards.
Eg. I have Vodafone in slot 1 and Airtel in slot 2. When I try to get the call logs in android it shows Vodafone as SimDisplayName for all entries form both SIM cards.
I debug and found that subscriberId/PhoneAccountId containing alphabet('F' in my case) in the end. I saw you code at CallLogPlugin.java (Line:215) Integer.toString(info.getSubscriptionId()).equals(accountId), if subId contains alphabet in the end then Integer.toString won't work.
Please suggest any possible fix for this.
Thanks
Is it within the scope of the package to make dateFrom/dateTo to accept DateTime objects directly, so people would write less millisecondsSinceEpoch (we're still accepting integers too)? I could implement the changes if so.
This number call history
I am getting a rejection from google play with the code you shared. Can you help me what should I do to get my application approved?
Thanks,
not ask me for permission and get this error
PlatformException(ALREADY_RUNNING, Method call was cancelled. One method call is already running, null, null)
can I know the response when the phone is rejected?
i can face this issue anyone can slove this problem
E/flutter (26847): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method get on channel sk.fourq.call_log)
E/flutter (26847): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:320:7)
E/flutter (26847):
E/flutter (26847): #1 CallLog.get (package:call_log/call_log.dart:12:39)
E/flutter (26847):
E/flutter (26847): #2 _startState._callLogs (package:untitled/start.dart:123:13)
E/flutter (26847):
E/flutter (26847): #3 _startState.build. (package:untitled/start.dart:239:19)
E/flutter (26847):
E/flutter (26847):
May I know will there be new enhancements to access the call logs in iOS device?
while useing "flutter run", i'm getting this note:
Note: /home/myuser/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.5/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Please update This package
hay, thank you for this plugin but it does not fetch unsave number, so how can i fetch all number save and unsave also
Can we have the country phone code and phone number separately?
Hi,
Any plans for this?
Thanks.
I faced me many problems with this package in my project, so I created new project and very time when running the app new problem appears
First Time
not aske me for PERMISSIONS and not get any data
Second Time
debug console print
D/flutter/CALL_LOG(22934): onMethodCall
E/flutter (22934): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(MISSING_PERMISSIONS, Permission READ_CALL_LOG or READ_PHONE_STATE is required for plugin. Hovewer, plugin is unable to request permission because of background execution., null, null)
E/flutter (22934): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:597
E/flutter (22934): #1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:158
E/flutter (22934):
E/flutter (22934): #2 CallLog.get
package:call_log/call_log.dart:12
E/flutter (22934):
E/flutter (22934): #3 _MyAppState.build.
package:crmapp/main.dart:53
E/flutter (22934):
E/flutter (22934):
Third time
debug console print
D/flutter/CALL_LOG(22934): onMethodCall
E/flutter (22934): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(ALREADY_RUNNING, Method call was cancelled. One method call is already running, null, null)
E/flutter (22934): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:597
E/flutter (22934): #1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:158
E/flutter (22934):
E/flutter (22934): #2 CallLog.get
package:call_log/call_log.dart:12
E/flutter (22934):
E/flutter (22934): #3 _MyAppState.build.
package:crmapp/main.dart:53
E/flutter (22934):
E/flutter (22934):
E/MethodChannel#sk.fourq.call_log(22934): Failed to handle method call
E/MethodChannel#sk.fourq.call_log(22934): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#sk.fourq.call_log(22934): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:155)
E/MethodChannel#sk.fourq.call_log(22934): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:243)
My Code
`import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@OverRide
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State {
Iterable _callLogEntries = [];
@OverRide
Widget build(BuildContext context) {
const TextStyle mono = TextStyle(fontSize: 20);
final List children = [];
for (CallLogEntry entry in _callLogEntries) {
children.add(
Column(
children: [
const Divider(),
Text('F. NUMBER : ${entry.formattedNumber}', style: mono),
Text('C.M. NUMBER: ${entry.cachedMatchedNumber}', style: mono),
Text('NUMBER : ${entry.number}', style: mono),
Text('NAME : ${entry.name}', style: mono),
Text('TYPE : ${entry.callType}', style: mono),
// Text('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.timestamp)}',
// style: mono),
Text('DURATION : ${entry.duration}', style: mono),
Text('ACCOUNT ID : ${entry.phoneAccountId}', style: mono),
Text('SIM NAME : ${entry.simDisplayName}', style: mono),
],
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
),
);
}
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('call_log example')),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () async {
final Iterable<CallLogEntry> result = await CallLog.query();
setState(() {
_callLogEntries = result;
});
},
child: const Text('Get all'),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(children: children),
),
],
),
),
),
);
}
}`
AndroidManifest.xml
<application
**Flutter doctor **
C:\Users\ENG_Ahmed>flutter doctor -v
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19042.1348], locale en-US)
• Flutter version 2.2.1 at C:\src\flutter
• Framework revision 02c026b03c (6 months ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\ENG_Ahmed\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:\Users\ENG_Ahmed\AppData\Local\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.62.3)
• VS Code at C:\Users\ENG_Ahmed\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.28.0
[√] Connected device (3 available)
• CPH1803 (mobile) • 192.168.1.202:5555 • android-arm64 • Android 8.1.0 (API 27)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.45
• Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.53
• No issues found!
Is there a way to lower the minimum sdk requirement. I am getting this error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 23 declared in library [:call_log] /Users/mbasa/Development/AndroidStudioProjects/flutter_todai_survey/build/call_log/intermediates/manifests/full/debug/AndroidManifest.xml as the library might be using APIs not available in 16
simDisplayName is always returning the name of sim card in the first sim slot for every entry in call log.
To avoid unexpected runtime failures, or future build failures, this plugin must be upgraded to Android embedding V2. Otherwise, a future release of Flutter will remove these deprecated APIs.
https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration
my code
final Iterable<CallLogEntry> result = await CallLog.query( number: '+62 852-3444-1010' );
log error
E/flutter ( 7923): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(INTERNAL_ERROR, near "ANDmatched_number": syntax error (code 1 SQLITE_ERROR): , while compiling: SELECT formatted_number, number, type, date, duration, name, numbertype, numberlabel, matched_number, subscription_id FROM calls WHERE ((number LIKE '%+62 852-3444-1010%'ANDmatched_number LIKE '%+62 852-3444-1010%'ANDsubscription_id LIKE '%+62 852-3444-1010%') AND ((type != 4)) AND ((phone_account_hidden = 0))) ORDER BY date DESC, null, null) E/flutter ( 7923): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7) E/flutter ( 7923): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18) E/flutter ( 7923): <asynchronous suspension> E/flutter ( 7923): #2 CallLog.query (package:call_log/call_log.dart:67:40) E/flutter ( 7923): <asynchronous suspension> E/flutter ( 7923): #3 _DetailFuState.build.<anonymous closure> (package:sales/apps/follow_up/local_widgets/detail_fu.dart:176:59) E/flutter ( 7923): <asynchronous suspension> E/flutter ( 7923):
help me
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.