-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
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
PERMISSIONS NOT WORK #30
Comments
Hello, Can you possibly attach that demo project? It would speed up fix. |
I am having the same problem. It seems like in the following line, the code is checking if activity is null. If so, it prints the error that permission cannot be requested by a background app. But the only place activity is set is in the deprecated code in the following line I was able to resolve the issue by adding and by adding Not sure if that is the intended use of |
Hi, yes that may be the problem, thanks. Are you planning to open PR? |
Hi @MartinHlavna , I have never done a PR but I will give it a try |
Fixed in |
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,
),
);
}
}
}`
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!
The text was updated successfully, but these errors were encountered: