I am following the tip here https://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/ to try acquire the permissions. Everything seems to be ok as once it is needed the Android dialogs popup and I confirm, but suddenly the app crashes without notice.

I am following the tip here https://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/ to try acquire the permissions. Everything seems to be ok as once it is needed the Android dialogs popup and I confirm, but suddenly the app crashes without notice.
All need it is a permission to get a screenshot and share/save.
https://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/

Comments

  1. It would help if you showed what you are actually doing, and/or what errors and/or logs correspond with the failure

    ReplyDelete
  2. David Nottage This is a very simple app, there's a button and the only code there inside is:
    FRequester.RequestPermissions([cPermissionReadExternalStorage,
    cPermissionWriteExternalStorage, cPermissionCamera],
    cPermissionsCodeExternalStorage);

    Just following every step of the article above, once we get the permissions the app closes. It's a bit hard to debug as I am using Android 8.0 and we have issues with that OS for debugging.

    So far the unique error message I was able to catch is about attempting to invoke a virtual method on a null object reference when I run the app again, after the permission were granted. I have no clue about what is missing because the message seems to be very generic:

    java.lang.NullPointerException: Attermpt to.. virtual method...'android.content.res.XmlResourseParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager.java.lang.String) on a null object referente'

    ReplyDelete
  3. Magno Lima That means you've missed the steps in relation to the Provider, as per the part in the article that immediately follows the text: "This is done by adding a Provider section..", up to the part that starts with the text: "Remember that when targeting API level 24 or greater.."

    ReplyDelete
  4. David Nottage Well, we have a problem here as the provider_class.xml is there already for deploying. I doubled checked it and my manifest also contains the provider section:

    android:authorities="com.embarcadero.testsc"
    android:exported="false" android:grantUriPermissions="true">



    For sure I am missing something, just need to figure out.

    Following these instructions: https://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/

    ReplyDelete
  5. Magno Lima You should not receive that error when calling RequestPermissions, so I'm guessing there's more to your app than you have said. I've just constructed another very basic app that does what you described and there is no error: github.com - MiscStuff

    ReplyDelete
  6. David Nottage Thank you for helping!! I was thinking exactly the same but that could be an issue with the project itself. I will test yours and let you know

    ReplyDelete

Post a Comment