Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

getPhoneLogs on device (version < android M) crashes #9

Description

@dolanor

Hi,
New to flutter, I wanted to access the call log and discovered that repo.

The problem I found was that getPhoneLogs access the permission API (available in android M) to check the permission. On a device with a version lower than that, it crashes. (log below)

I fixed it with a SDK check before calling a function with permission API, and one without permission API to be able to be called from older version.
I'll send some PR if that's ok.

E/flutter (11916): [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:classes2.dex)
E/flutter (11916): at com.jiajiabingcheng.phonelog.PhoneLogPlugin.fetchCallRecords(PhoneLogPlugin.java:146)
E/flutter (11916): at com.jiajiabingcheng.phonelog.PhoneLogPlugin.onMethodCall(PhoneLogPlugin.java:58)
E/flutter (11916): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
E/flutter (11916): at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188)
E/flutter (11916): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
E/flutter (11916): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (11916): at android.os.MessageQueue.next(MessageQueue.java:143)
E/flutter (11916): at android.os.Looper.loop(Looper.java:130)
E/flutter (11916): at android.app.ActivityThread.main(ActivityThread.java:5834)
E/flutter (11916): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (11916): at java.lang.reflect.Method.invoke(Method.java:372)
E/flutter (11916): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
E/flutter (11916): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
E/flutter (11916): F/flutter (11916): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env). F/libc (11916): Fatal signal 6 (SIGABRT), code -6 in tid 11916 (.example.regord)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/kltexx/klte:5.0/LRX21T/G900FXXU1BNL9:user/release-keys'
Revision: '14'
ABI: 'arm'
pid: 11916, tid: 11916, name: .example.regord >>> com.example.regord <<<
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 00002e8c r2 00000006 r3 00000000
r4 b6f1e114 r5 00000006 r6 0000000b r7 0000010c
r8 bef48c94 r9 00000008 sl 00000001 fp aeda3388
ip 00002e8c sp bef48b78 lr b6ea7fd5 pc b6ecb978 cpsr 600d0010
backtrace:
#00 pc 00037978 /system/lib/libc.so (tgkill+12)
#01 pc 00013fd1 /system/lib/libc.so (pthread_kill+52)
#02 pc 00014bef /system/lib/libc.so (raise+10)
#03 pc 00011531 /system/lib/libc.so (__libc_android_abort+36)
#04 pc 0000fcbc /system/lib/libc.so (abort+4)
#05 pc 0002ebb7 /data/app/com.example.regord-1/lib/arm/libflutter.so
#06 pc 000252e5 /data/app/com.example.regord-1/lib/arm/libflutter.so
#07 pc 00024745 /data/app/com.example.regord-1/lib/arm/libflutter.so
#08 pc 00055849 /data/app/com.example.regord-1/lib/arm/libflutter.so
#09 pc 0002fd99 /data/app/com.example.regord-1/lib/arm/libflutter.so
#10 pc 00031295 /data/app/com.example.regord-1/lib/arm/libflutter.so
#11 pc 0001030f /system/lib/libutils.so (android::SimpleLooperCallback::handleEvent(int, int, void*)+10)
#12 pc 00010f6f /system/lib/libutils.so (android::Looper::pollInner(int)+482)
#13 pc 00011019 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
#14 pc 00083079 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#15 pc 000b2397 /system/framework/arm/boot.oat

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions