Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26238

Android: Storage-permissions issue on Android 8 (API 26+)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Ti SDK : 7.3.X
      Android Build Tools: 27.0.3
      Executing App in a Samsung Galaxy S7 Android 8.0

      Description

      I've made a four different ways to check and request storage permissions. One of them fails, combining Ti.Android.hasPermission and Ti.filesystem.requestStoragePermissions

      I attached the sample app. Special attention in tiapp.xml. The permission WRITE_EXTERNAL_STORAGE is declared explicitly in the android manifest section and the override property set to true.

      After each test, if you disable storage permissions manually from app settings page the log will be disconnected. For a correct testing:

      Uninstall the app and build again.

      Behaviour:

      First execution trace

      Check permissions with: Ti.Android.hasPermission
      Requesting permissions with: Ti.Filesystem.requestStoragePermissions
      hasStoragePermission
      Ti.Android.hasPermission("android.permission.WRITE_EXTERNAL_STORAGE"): false
      requestFilesystemPermission
      Ti.Filesystem.requestStoragePermissions

      [Prompt permission grant dialog] Allow

      requestPermissionCallback
      Permission Filesystem permission granted.
      Finished

      OK -> Permission granted

      Trying again

      Check permissions with: Ti.Android.hasPermission
      Requesting permissions with: Ti.Filesystem.requestStoragePermissions
      hasStoragePermission
      Ti.Android.hasPermission("android.permission.WRITE_EXTERNAL_STORAGE"): false
      requestFilesystemPermission
      Ti.Filesystem.requestStoragePermissions

      FAIL

      Second execution trace

      Check permissions with: Ti.Android.hasPermission
      Requesting permissions with: Ti.Filesystem.requestStoragePermissions
      hasStoragePermission
      Ti.Android.hasPermission("android.permission.WRITE_EXTERNAL_STORAGE"): false
      requestFilesystemPermission
      Ti.Filesystem.requestStoragePermissions

      FAIL

      Other 3 combinations works fine:

      Native method:

      Check permissions with: Ti.Android.hasPermission
      Requesting permissions with: Ti.Android.requestPermissions

      OK

      Filesystem method:

      Check permissions with: Ti.Filesystem.hasStoragePermissions
      Requesting permissions with: Ti.Filesystem.requestStoragePermissions

      OK

      Mixed method B:

      Check permissions with: Ti.Filesystem.hasStoragePermissions
      Requesting permissions with: Ti.Android.requestPermissions

      OK

        Attachments

        1. CameraExternalTest.js
          1 kB
          Joshua Quick
        2. test-result.txt
          5 kB
          Jorge Macias Garcia

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              jormagar Jorge Macias Garcia
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6481
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code