We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
I still have the same problem
Sorry, something went wrong.
I have the same problem
I still have the this problem. I want to run on background
I found the solution.
first step - delete call_log and work manager
second step install https://pub.dev/packages/flutter_background_service install https://pub.dev/packages/pit_sms_call_log
enjoy 💯
Background execution support added in 2.2.0
No branches or pull requests
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:
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
The text was updated successfully, but these errors were encountered: