DRSchlaubi / contact_picker

A Flutter plugin for picking a contact from the address book.
https://pub.dev/packages/fluttercontactpicker
BSD 3-Clause "New" or "Revised" License
18 stars 37 forks source link

Fail to pick contact on Oppo Reno2 F #63

Open daadu opened 2 years ago

daadu commented 2 years ago
2022-11-15 13:18:45.364 1520-6273/? E/OplusTrack-ApkInfoUtil: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.os.Bundle.get(java.lang.String)' on a null object reference
2022-11-15 13:18:45.364 1520-4152/? W/WindowManager: Changing focus fromWindow{6df1ee8 u0 com.android.contacts/com.android.contacts.activities.ContactSelectionActivity} to null displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:509 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6076 com.android.server.wm.DisplayContent.setFocusedApp:5895 com.android.server.wm.ActivityTaskManagerService.setResumedActivityUncheckLocked:5860 
2022-11-15 13:18:45.364 1520-6273/? W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.os.Bundle.get(java.lang.String)' on a null object reference
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.h.b.d(ApkInfoUtil.java:136)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.b.b.a(TrackEvent.java:141)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.b.b.<init>(TrackEvent.java:47)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.b.a.<init>(CommonBean.java:37)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.c.a(OplusTrack.java:223)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.e.a.a$a.a(AppLaunchEventRecorder.java:143)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.e.a.a$a.a(AppLaunchEventRecorder.java:102)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.e.a.-$$Lambda$2fHLmT8JZlr5OzkT2xnqiCVdLEk.onAppSwitch(Unknown Source:2)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.c.b.a(AppSwitchMonitor.java:97)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.c.b.lambda$yF2sSrETF4wpk07pjuI1ubPVnB8(Unknown Source:0)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.c.-$$Lambda$b$yF2sSrETF4wpk07pjuI1ubPVnB8.accept(Unknown Source:4)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:832)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.c.b.b(AppSwitchMonitor.java:97)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.c.b.lambda$fX4Hi7f3z5t3AW9aa0q-E6iGF5w(Unknown Source:0)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at com.oplus.statistics.c.-$$Lambda$b$fX4Hi7f3z5t3AW9aa0q-E6iGF5w.run(Unknown Source:4)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2022-11-15 13:18:45.364 1520-6273/? W/System.err:     at java.lang.Thread.run(Thread.java:923)

From dart the await FlutterContactPicker.pickPhoneContact() method call gets stuck and never return. Also I noticed that the permission is asked as expected.

daadu commented 2 years ago
daadu commented 2 years ago

Ok, the issue seems with android:launchMode="singleInstance in my app's android manifest [it is android:launchMode="singleTop" in the example app].

Once I changed to singleTop it started working. Any idea why is that a case? Is it a bug?

DRSchlaubi commented 2 years ago

The stacktrace doesn't show anything related to this package?

daadu commented 2 years ago

Yes

The stacktrace doesn't show anything related to this package?

Yes, released it after some debugging. It has to do with the launchMode set by the activity. for some reason, onActivityResult is not called when app launched with launchMode=singleInstance

daadu commented 2 years ago

onActivityResult is being called with requestCode: 0, resultCode: 0, data: null when android:launchMode="singleInstance" set on these devices.

a313 commented 1 year ago

I have same issue. Can't pick contact, I have put an try catch then it throw an error UserCancelledPickingException: The user hit the back button instead of selecting a contact @DRSchlaubi

Update: After changed android:launchMode="singleInstance" -> android:launchMode="singleTop" it worked