Error when trying to use the flash.on() method for android torch app
103 views
Skip to first unread message
Sulav Rai
unread,
Feb 28, 2023, 6:31:57 PM2/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
I am building an app that turns an Android flashlight on and off. I have debugged a lot but I do not know how to fix this error that shows up in the Logcat debugger.
jnius.jnius.JavaException: Cannot call instance method b'getParameters' on class b'android/hardware/Camera'
The relevant code snippit is below
import json
from kivy.app import App
from kivy.core.window import Window # For the Background colour
from kivy.lang import Builder
from kivy.properties import ObjectProperty
from kivy.uix.screenmanager import ScreenManager, Screen
from datetime import datetime
from plyer import flash
from kivy import platform
if platform == "android":
from android.permissions import request_permissions, Permission
request_permissions([Permission.CAMERA])
class LockMain(Screen):
def torch(self): # Will turn the torch on
flash.on()
Robert
unread,
Feb 28, 2023, 7:43:30 PM2/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
Plyer is not well maintained. If it works, great. If not figure out how to do what you want with Pyjnius and the Android api.