User Tools

Site Tools


doc:appunti:prog:kivy_debian_12_android_11

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:prog:kivy_debian_12_android_11 [2023/10/04 17:31] – [Writing the buildozer.spec file] niccolodoc:appunti:prog:kivy_debian_12_android_11 [2024/04/04 09:31] (current) – [Web Resources] niccolo
Line 181: Line 181:
 You can use **presplash.filename** and **icon.filename** to include two artwork in your app. The //presplash// will be displayed at startup, during the initialization of the environment (unfortunately it is rather time consuming). The //icon// is instead what you can imagine. Use PNG graphics at least 512 x 512 pixels, you can use transparency too. You can use **presplash.filename** and **icon.filename** to include two artwork in your app. The //presplash// will be displayed at startup, during the initialization of the environment (unfortunately it is rather time consuming). The //icon// is instead what you can imagine. Use PNG graphics at least 512 x 512 pixels, you can use transparency too.
  
-In **android.permissions** you must list all the permissions that your app will require from the operating system. If you forget to declare something your app simply will not be able to do that operation. Beware that starting from Android 10 the access to the external storae (basically the space into the SD card or into the device memory) has undergone a drastic change, see the table below for a basic overview.+In **android.permissions** you must list all the permissions that your app will require from the operating system. If you forget to declare something your app simply will not be able to do that operation. Beware that starting from Android 10 the access to the external storage (basically the space into the SD card or into the device memory) has undergone a drastic change, see the table below for a basic overview.
  
-^ READ_EXTERNAL_STORAGE   | This was the long-established permission required by the apps to read the [[https://android.googlesource.com/platform/docs/source.android.com/+/android-4.2.1_r1.1/src/tech/storage/index.md|external storage]] (a permissionless filesystem residing into the SD card or into a dedicated partition of the device internal storage). This is not longer true starting from **Android 10** (API level 29) which introduced the **scoped storage**, designed to protect app and user data and reduce file clutter; requesting ''READ_EXTERNAL_STORAGE'' in Android 10 actually means requesting access only to **photos and media**. Afterwards **Android 11** (API level 30) fixed several problems with that implementation; in Android 11 and above requesting ''READ_EXTERNAL_STORAGE'' does not give you any actual permission. Generally, in Android 11, an app cannot access the root directory of the SD card and the Download directory, it can access only its ASD (App Specific Directory).  |+^ READ_EXTERNAL_STORAGE   | This was the long-established permission required by the apps to read the [[https://android.googlesource.com/platform/docs/source.android.com/+/android-4.2.1_r1.1/src/tech/storage/index.md|external storage]] (a permissionless filesystem residing into the SD card or into a dedicated partition of the device internal storage). If you want e.g. to read the pictures from the DCIM folder of an **Android 8** device, you must grant this permission. This is not longer true starting from **Android 10** (API level 29) which introduced the **scoped storage**, designed to protect app and user data and reduce file clutter; requesting ''READ_EXTERNAL_STORAGE'' in Android 10 actually means requesting access only to **photos and media**. Afterwards **Android 11** (API level 30) fixed several problems with that implementation; in Android 11 and above requesting ''READ_EXTERNAL_STORAGE'' does not give you any actual permission. Generally, in Android 11, an app cannot access the root directory of the SD card and the Download directory, it can access only its ASD (App Specific Directory).  |
 ^ WRITE_EXTERNAL_STORAGE  | The same as ''READ_EXTERNAL_STORAGE'', but for write permission.  | ^ WRITE_EXTERNAL_STORAGE  | The same as ''READ_EXTERNAL_STORAGE'', but for write permission.  |
-^ CAMERA                  | With this permission an app can use the external storage even with Android 10 and above, but limited to the shared folders like **Pictures****DCIM**, etc. FIXME Check if this is true! May be accessing a ''DCIM/SUBFOLDER/'' is always granted if files are .jpg or similar media files.  |+^ CAMERA                  | Writing .jpg or similar media files under the Android shared folders **DCIM** or **Pictures** (or subfolders therein), is always permitted; no particular permission is required even in Android 11Requesting the CAMERA permission allow to use the camera itself, the flash, etc.  |
 ^ MANAGE_EXTERNAL_STORAGE  | Starting from Android 11, this is the permission required to access all the files into the storage. The app should also provide an ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION intent. App requesting this permission may have trouble getting into the Google Play Store.  | ^ MANAGE_EXTERNAL_STORAGE  | Starting from Android 11, this is the permission required to access all the files into the storage. The app should also provide an ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION intent. App requesting this permission may have trouble getting into the Google Play Store.  |
  
-=== Compile SDK vs Target SDK === +=== Target API vs Minimum API vs Compile SDK === 
-==== Compiling the package ====+ 
 +Into the **buildozer.spec** you can define the following: 
 + 
 +<file> 
 +# (int) Target Android API, should be as high as possible. 
 +#android.api 31 
 + 
 +# (int) Minimum API your APK / AAB will support. 
 +#android.minapi 21 
 + 
 +# (int) Android SDK version to use 
 +#android.sdk 20 
 +</file> 
 + 
 +By setting a **target API** lower than your SDK can support, you can declare what will be the highest Android version that your app is designed to be compatible with. At the moment Buildozer will try to target API 31 (**Android 12**). 
 + 
 +Declaring a **minimum API** you can tell what is the minimum Android version required by your app. We did not declared the android.minapi, so Buildozer choosed API 21 (**Android 5.0.2**). 
 + 
 +The **compile SDK** is the environment you want to use to create the app, i.e. the SDK you downloaded from Google (which generally support the higher API available at the moment). This will affects what functions and constructs you can use in your program. If you do not specify a version, Buildozer should detect the highest SDK downloaded and use it. In our case only one SDK was downloaded, and it was SDK API 31. 
 + 
 +==== Compiling the package (debug or release) ==== 
 + 
 +Enter the project directory and edit the **main.py** source code updating the definition of the **%%__version__%%** variable (the **buildozer.spec** will refer this value to create the package name). Then choose to make a debug build:
  
 <code> <code>
-# Choose debug or release build: 
 buildozer android debug buildozer android debug
-#buildozer android release 
 </code> </code>
 +
 +The package will be created into the **bin/** subdirectory, using a name like **packagename-version-arm64-v8a_armeabi-v7a-debug.apk**.
 +
 +When you are ready to **publish** your package, you must create the //release// binary:
 +
 +<code>
 +buildozer android release
 +</code>
 +
 +In this case the package created into the **bin/** subdirectory will be named like **packagename-version-arm64-v8a_armeabi-v7a-release.aab**, which is not directly installable into the device.
 +
  
 ===== Web Resources ===== ===== Web Resources =====
Line 217: Line 248:
   * **[[https://community.appinventor.mit.edu/t/how-to-access-non-media-media-files-on-android-11/54828|How to access non-media & media files on Android 11+]]**   * **[[https://community.appinventor.mit.edu/t/how-to-access-non-media-media-files-on-android-11/54828|How to access non-media & media files on Android 11+]]**
   * **[[https://community.appinventor.mit.edu/t/asd-app-specific-directory-vs-private-folder/19154|ASD (app specific directory) vs Private folder]]**   * **[[https://community.appinventor.mit.edu/t/asd-app-specific-directory-vs-private-folder/19154|ASD (app specific directory) vs Private folder]]**
 +  * **[[https://developer.android.com/training/data-storage/shared/media|Access media files from shared storage]]**
  
doc/appunti/prog/kivy_debian_12_android_11.1696433490.txt.gz · Last modified: 2023/10/04 17:31 by niccolo