Kivy App on Android not asking for permission

2,282 views
Skip to first unread message

Carsten Thielepape

unread,
Jul 24, 2019, 6:35:35 AM7/24/19
to Kivy users support
Hi,

my Kivy App on Android is not asking for permissions on first App start. I fact,, my app needs the WRITE_EXTERNAL_STORAGE permission. The permissions I need are properly in the buildozer.spec file:
When I look into the APKs manifest file, the permissions are there as well
Just on App start, there is no popup coming to ask the user to grant the permission. If I manualy grant the permission after App installation and before App start. everything works fine. Is this something, the Kivy App need to care about itself in the code?



[app]

# (str) Title of your application
title = ORCA - Open Remote Control Application

# (str) Package name

# (str) Package domain (needed for android/ios packaging)
package.domain = org.orca

# (str) Source code where the main.py live
source.dir = /home/kivy/work/src

# (list) Source files to include (let empty to include all the files)
#source.include_exts = .pyc,.ini

# (list) Source files to exclude (let empty to not exclude anything)
# source.exclude_exts = protected

# (list) List of directory to exclude (let empty to not exclude anything)
# source.exclude_dirs = 

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
version.regex = self.sVersion=['"](.*)['"]
version.filename = %(source.dir)s/ORCA/App.py
# (str) Application versioning (method 2)
#version = 1.1.0
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,future,openssl,png,pyjnius,plyer,rsa,sdl2,android,pyasn1,wakeonlan,ws4py,httplib2,jpeg,cryptography

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (list) Garden requirements
#garden_requirements =
# (str) Presplash of the application
presplash.filename = /mnt/ORCA/Graphics/Android_Logo/orca-presplash.jpg
# (str) Icon of the application
icon.filename = /mnt/ORCA/Graphics/Android_Logo/ic_launcher_orca_lpi.png
# (str) Supported orientation (one of landscape, portrait or all)
orientation = all
# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0
#
# Android specific
#
# (list) Permissions
android.permissions = INTERNET,VIBRATE,BLUETOOTH,WRITE_EXTERNAL_STORAGE,ACCESS_WIFI_STATE,ACCESS_NETWORK_STATE,TRANSMIT_IR
# (int) Android API to use
# android.minapi = 8
# we need 18 for locking screen rotation, we set it to 19 (KitKat)
android.minapi = 21
# (int) Android SDK version to use
# android.sdk = 17
# (str) Android NDK version to use
# android.ndk = 9d
# (bool) Use --private data storage (True) or --dir public storage (False)
# android.private_storage = False
# android.private_storage = True
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
# android.ndk_path =
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
# android.sdk_path =
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
# android.p4a_dir =
# p4a.source_dir = /home/kivy/python-for-android-stable/
# (list) python-for-android whitelist
# android.p4a_whitelist =
# (str) Android entry point, default is ok for Kivy-based app
# android.entrypoint = org.renpy.android.PythonActivity
# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
# android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
# android.add_src =
# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
# android.branch = master
# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
# android.ouya.category = APP
# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
# android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png
# (str) XML file to include as an intent filters in <activity> tag
# android.manifest.intent_filters =
# (list) Android additionnal libraries to copy into libs/armeabi
# android.add_libs_armeabi = libs/android/*.so
# android.add_libs_armeabi_v7a = libs/android-v7/*.so
# android.add_libs_x86 = libs/android-x86/*.so
# android.add_libs_mips = libs/android-mips/*.so
# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
# android.wakelock = False
# (list) Android application meta-data to set (key=value format)
# android.meta_data =
# (list) Android library project to add (will be added in the
# project.properties automatically.)
# android.library_references =
#
#
# OSX Specific
#

#
author = Carsten Thielepape

# change the major version of python used by the app
osx.python_version = 2

# Kivy version to use
osx.kivy_version = 1.10.1



Quan Lin

unread,
Jul 24, 2019, 10:21:48 PM7/24/19
to Kivy users support

Runtime permissions

With API level >= 21, you will need to request runtime permissions to access the SD card, the camera, and other things.

This can be done through the android module which is available per default unless you blacklist it. Use it in your app like this:

from android.permissions import request_permissions, Permission
request_permissions([Permission.WRITE_EXTERNAL_STORAGE])


It is found in the latest python for android document:
Reply all
Reply to author
Forward
0 new messages