{"id":16651221,"url":"https://github.com/asfdfdfd/defold-android-permissions","last_synced_at":"2025-04-09T17:31:18.528Z","repository":{"id":150346764,"uuid":"186672917","full_name":"asfdfdfd/defold-android-permissions","owner":"asfdfdfd","description":null,"archived":false,"fork":false,"pushed_at":"2019-05-14T19:25:11.000Z","size":9,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T19:39:06.082Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asfdfdfd.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-14T17:52:16.000Z","updated_at":"2024-03-23T11:06:45.000Z","dependencies_parsed_at":"2023-04-25T23:17:48.586Z","dependency_job_id":null,"html_url":"https://github.com/asfdfdfd/defold-android-permissions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asfdfdfd%2Fdefold-android-permissions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asfdfdfd%2Fdefold-android-permissions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asfdfdfd%2Fdefold-android-permissions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asfdfdfd%2Fdefold-android-permissions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asfdfdfd","download_url":"https://codeload.github.com/asfdfdfd/defold-android-permissions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248077290,"owners_count":21043934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T09:24:11.541Z","updated_at":"2025-04-09T17:31:18.233Z","avatar_url":"https://github.com/asfdfdfd.png","language":"C++","funding_links":["https://www.patreon.com/bePatron?u=2321396"],"categories":[],"sub_categories":[],"readme":"Defold Android Permissions\n--------------------------\n\nThis is `Native Extension \u003chttps://www.defold.com/manuals/extensions/\u003e`_ for the `Defold Game Engine \u003chttps://www.defold.com\u003e`_ that adds support for `Android Runtime Permissions \u003chttps://developer.android.com/guide/topics/permissions/overview\u003e`_.\n\n.. raw:: html\n\n    \u003ca href=\"https://www.patreon.com/bePatron?u=2321396\"\u003e\u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button.png\" alt=\"Become a Patron!\"/\u003e\u003c/a\u003e\n\nSetup\n=====\n\nYou can use extension in your own project by adding this project as a `Defold library dependency \u003chttps://www.defold.com/manuals/libraries/\u003e`_. Open your game.project file and in the dependencies field under project add https://github.com/asfdfdfd/defold-android-permissions/archive/master.zip or point to the ZIP file of a `specific release \u003chttps://github.com/asfdfdfd/defold-android-permissions/releases\u003e`_.\n\nImplementation details\n======================\n\nBefore requesting permissions you have to add them to the AndroidManifest.xml.\n\nIf you are working on cross-platform application the best practice is to check the existence of `android_permissions` module, this module exists only in android bundle:\n\n.. code:: lua\n\n    if android_permissions then\n      -- call android_permissions methods\n    end\n\nAPI\n===\n\nandroid_permissions.is_permission_granted(permission)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nReturns 'true' if permission is granted.\n\n.. code:: lua\n\n     android_permissions.is_permission_granted(\"android.permission.READ_CONTACTS\")\n\nandroid_permissions.request_permissions(permissions, callback_function)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nRequests permissions from user and returns result dictionary in 'callback_function'. Dictionary key is permission name, dictionary value is 'android_permissions.PERMISSION_GRANTED' if permission request is granted, 'android_permissions.PERMISSION_DENIED' if permission request is denied and 0 if permission request is cancelled.\n\n.. code:: lua\n\n    local permissions = {\"android.permission.WRITE_EXTERNAL_STORAGE\", \"android.permission.READ_CONTACTS\"}\n\n    android_permissions.request_permissions(permissions, function (results)\n        for permission, grant_result in pairs(results) do\n            if grant_result == android_permissions.PERMISSION_GRANTED then \n                -- do something.\n            elseif grant_result == android_permissions.PERMISSION_DENIED then\n                -- do something.            \n            end\n        end\n    end)\n\nandroid_permissions.should_show_request_permission_rationale(permission)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nChecks whether you should show UI with rationale for requesting a permission. You should do this only if you do not have the permission and the context in which the permission is requested does not clearly communicate to the user what would be the benefit from granting this permission.\n\nReturns 'true' if application should show rationale.\n\n.. code:: lua\n\n     android_permissions.should_show_request_permission_rationale(\"android.permission.READ_CONTACTS\")","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasfdfdfd%2Fdefold-android-permissions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasfdfdfd%2Fdefold-android-permissions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasfdfdfd%2Fdefold-android-permissions/lists"}