How to Remove a Permission from my game?

  • Essentially i need to remove following permissions from being asked in my game:

    • READ_EXTERNAL_STORAGE

    • WRITE_EXTERNAL_STORAGE

    I use following Plugins:

    • Audio

    • Browser

    • GameRecorder

    • Share

    • TextInput

    • Touch

    • Dictionary

    • AJAX

    • BinaryData

    • LocalStorage

    Please Help me Solve this!

    Thank you in Advance!

  • I don't know where READ_EXTERNAL_STORAGE comes from, but WRITE_EXTERNAL_STORAGE is currently added by Cordova. An issue was filed for it here: https://github.com/Scirra/Construct-3-bugs/issues/3306

    I think the permissions can be removed manually if you do an Android Studio build? Maybe Nepeo can tell more.

    Alternatively you could just reply and say they're added by the Cordova framework but aren't currently used, and see if Google accept that.

  • Thanks for the quick reply!

    I will try explaining the cordova issue although it would be better if i can remove them as u said.

    But i don't know about how to do an android studio build so a little help there would be really nice.

  • Hi,

    Can someone please tell me how to remove them manually in android studio, i have installed and added my project in Android Studio,

    It looks like this...

    What to do?

  • Looks like these 2 permissions are added by "cordova-plugin-file" plugin. If you remove this plugin from config files, permissions disappear from the manifest, but the app won't start..

    .

    Shubi I was able to remove these permissions when building with Cordova CLI. It's not an easy process if you've never done this before.. Follow this tutorial:

    construct.net/en/tutorials/from-cordova-export-to-signed-apk-with-cordova-cli-on-windows-10-1420

    After the "cordova prepare" step search for all .xml and json files containing "WRITE_EXTERNAL_STORAGE" and remove entire blocks with them, for example:

    in xml files remove:
    
    <config-file target="AndroidManifest.xml" parent="/*">
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    </config-file>
    
    
    in json files remove:
    
    {
    "xml": "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />","count": 1
    }
    
    
  • I have commented this before in another thread.

    When I switch between C3/C2-runtimes and switch between andriod versions 5.0/5.1/6.0 the permission for READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE changes for me. I am not not fully sure when it is requested and when it is not.. but sometimes I get it, and sometimes I don't, without changing anything in the project expect the runtime and export.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • dop2000

    Shubi I was able to remove these permissions when building with Cordova CLI. It's not an easy process if you've never done this before.. Follow this tutorial:

    https://www.construct.net/en/tutorials/from-cordova-export-to-signed-apk-with-cordova-cli-on-windows-10-1420

    After the "cordova prepare" step search for all .xml and json files containing "WRITE_EXTERNAL_STORAGE" and remove entire blocks with them, for example:

    There are 86 .xml & 136 json files in that folder! do i have to remove from all of them one by one?

    Edit : Also after the "prepare cordova" screen looks likes this...

    is this ok?

  • There are 86 .xml & 136 json files in that folder! do i have to remove from all of them one by one?

    Search for "WRITE_EXTERNAL_STORAGE" string, there will only be a few such files.

    Also, I can't guarantee that this is the right method. It removes the permissions, but may break something else, test your game thoroughly.

    Edit : Also after the "prepare cordova" screen looks likes this...

    I don't know.. Try building the app, if there are any serious issues, the build will fail.

    After you get the APK, you can open it in Android Studio ("Profile or debug APK") and check the andoid manifest file for those permissions.

  • > There are 86 .xml & 136 json files in that folder! do i have to remove from all of them one by one?

    Search for "WRITE_EXTERNAL_STORAGE" string, there will only be a few such files.

    But which ones? as i told you there are over 200 such files, in which ones should i search?

  • You can search in Windows by file contents. But I prefer using file managers, like Total Commander:

    Here are the results I found, there may be more in your project:

  • You can search in Windows by file contents. But I prefer using file managers, like Total Commander:

    That worked for .Xml i found 3 files, For some reason i did not found any results in .json

    Trying to build now!

  • dop2000

    Sadly It failed for some reasons...

    Any ideas on what to do now?

  • Building with Cordova CLI is difficult, you need to google error messages, fix the issues and try again.

    Try building an unchanged cordova project, maybe you made some mistake when editing the xml files.

  • I tried this...

    https://stackoverflow.com/questions/43426393/error-could-not-find-or-load-main-class-org-gradle-launcher-gradlemain

    But it still gives the same error...

    Error: Could not find or load main class org.gradle.launcher.GradleMain

    Don't know what to do now! have to submit the app by tomorrow with permissions removed.

    Edit : Found the problem was in path of the project file as it contained special characters...

    Trying to build again!

  • Shubi When you open your project in Android Studio the Gradle sync will initially fail, this is because they changed something in Gradle and Cordova hasn't caught up yet. Here is how to resolve the issue so you can use the project.

    Select the error message The minSdk version should not be declared in the android manifest file...

    In the right hand panel it will repeat the description, and there will be some text in blue that you can click on saying "Move minSdkVersion to build files and sync project".

    Finally click the "Do refactor" button to confirm you want it to make the change.

    It might take a moment to complete the sync. You will likely have a warning about the targetSdk version still, but no errors. You can repeat this process for the targetSdk if you wish but it doesn't matter.

    Now that you have hopefully got the project working again we can remove the permissions. In the project bar select App > manifests > AndroidManifest.xml and double click to open the file.

    Inside this file you should have some lines that look like <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />. These are the declarations that each permission is required. If you delete the line, the project will no longer include that permission requirement. Delete the permissions you do not want.

    To get your release APK go to the top menu and select Build > Generate Signed Bundle / APK and follow the on screen instructions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)