Thank you Robert!
For completeness, here is what I have that will save a picture to Download, Documents, Pictures, and probably a couple other places per your article.
Still need to go into the app settings and allow "Camera" and "Files and media".
Buildozer:
android.permissions = WRITE_EXTERNAL_STORAGE, CAMERA
android.api = 32
```
import kivy
from
kivy.app import App
from kivy.uix.label import Label
from android.storage import app_storage_path,primary_external_storage_path,\
secondary_external_storage_path
from android.permissions import request_permissions, check_permission, \
Permission
from os.path import abspath
from os import getcwd
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
import time
from kivy.properties import StringProperty
from kivy.utils import platform
Builder.load_string('''
<CameraClick>:
orientation: 'vertical'
Camera:
id: camera
resolution: (640, 480)
play: False
ToggleButton:
text: 'Play'
on_press:
camera.play = not
camera.play size_hint_y: None
height: '48dp'
Button:
text: 'Capture'
size_hint_y: None
height: '48dp'
on_press: root.capture()
Label:
text: root.PictureName
size_hint_y: None
height: '48dp'
''')
class CameraClick(BoxLayout):
PictureName = StringProperty()
def capture(self):
'''
Function to capture the images and give them the names
according to their captured time and date.
'''
if platform == 'android':
from android.storage import primary_external_storage_path
camera = self.ids['camera']
timestr = time.strftime("%Y%m%d_%H%M%S")
picturename = join(primary_external_storage_path(),"Pictures/IMG_{}.png".format(timestr))
# ~ picturename = join(primary_external_storage_path(),"Download/IMG_{}.png".format(timestr))
# ~ picturename = join(primary_external_storage_path(),"Documents/IMG_{}.png".format(timestr))
self.PictureName = picturename
camera.export_to_png(picturename)
class TestCamera(App):
def build(self):
return CameraClick()
TestCamera().run()
```