Yes thank you DonManfred to replay
but I did not understand this sentence: "2. Make sure to use Runtimepermission and request permission as it is a dangerous permission."
the permission Iìm using are the same as in the image above.
As you can see already I use the permissions android.permission.READ_CONTACTS and android.permission.WRITE_CONTACTS
as the error is complaining
Error:
Logger connected to: ee64cc2d0403
--------- beginning of system
--------- beginning of main
Service started in the background. Trying to start again in foreground mode.
*** Service (starter) Create ***
** Service (starter) Start **
Service started in foreground mode.
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
contactsutils_findcontactsidfromdata (java line: 307)
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{7d5607b 17576:b4a.example/u0a301} (pid=17576, uid=10301) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
at android.os.Parcel.createExceptionOrNull(Parcel.java:2376)
at android.os.Parcel.createException(Parcel.java:2360)
at android.os.Parcel.readException(Parcel.java:2343)
at android.os.Parcel.readException(Parcel.java:2285)
at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:5983)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:6974)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2958)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:2506)
at android.content.ContentResolver.query(ContentResolver.java:1179)
at android.content.ContentResolver.query(ContentResolver.java:1127)
at android.content.ContentResolver.query(ContentResolver.java:1083)
at anywheresoftware.b4a.objects.ContentResolverWrapper.Query(ContentResolverWrapper.java:49)
at b4a.example.contactsutils._findcontactsidfromdata(contactsutils.java:307)
at b4a.example.contactsutils._findallcontacts(contactsutils.java:238)
at b4a.example.main._button1_click(main.java:372)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:7566)
at android.view.View.performClickInternal(View.java:7539)
at android.view.View.access$3600(View.java:831)
at android.view.View$PerformClick.run(View.java:28876)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7864)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.getContentProviderImpl(ActivityManagerService.java:7520)
at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:7995)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2509)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2987)
at android.os.Binder.execTransactInternal(Binder.java:1154)
--------- beginning of crash
[IDE message - 7:04:25]
An error occurred.
Requested Clipboard operation did not succeed.