how do I read Android settings from Kivy?

49 views
Skip to first unread message

Антон Чивчалов

unread,
Feb 1, 2023, 5:15:03 AM2/1/23
to Kivy users support
Please, can anybody give me a code example or point to any reference explaining how to read/get Android settings using jnius. Namely, I need to read the TEXT_AUTO_CAPS (https://developer.android.com/reference/android/provider/Settings.System#TEXT_AUTO_CAPS) setting from my Kivy app. It is somewhere in "android.provider.Settings.System" and defines whether to capitalize the first letter in a sentence. But googlling on this matter gives me nothing. I'm sure it's quite possible with jnius. 

Robert

unread,
Feb 1, 2023, 4:20:42 PM2/1/23
to Kivy users support
> I'm sure it's quite possible with jnius. 
I admire your confidence

I have never tried to do this, so curious I looked for a Java example (I see your api reference link) I couldn't find one :(

If you find one, here is your Pyjnus starting point https://github.com/Android-for-Python/Android-for-Python-Users#basic-pyjnius-usage

Anton Chivchalov

unread,
Feb 3, 2023, 9:16:48 AM2/3/23
to Kivy users support
Well, this code perfectly works for another setting from the same Android docs page I gave:

from jnius import autoclass
from android import mActivity
System = autoclass('android.provider.Settings$System')
caps = System.getInt(mActivity.getContentResolver(), System. SCREEN_BRIGHTNESS)
self.mylabel.text = str(caps)

But if I only replace SCREEN_BRIGHTNESS with TEXT_AUTO_CAPS, it crashes. I can't understand why these two settings from the same 'android.provider.Settings$System' behave differently.




четверг, 2 февраля 2023 г. в 00:20:42 UTC+3, Robert:

Robert

unread,
Feb 3, 2023, 6:52:28 PM2/3/23
to Kivy users support
Looks like your conversation on Reddit might shed some light.

Btw you can get a logcat,  install adb on the Windows side and copy the apk there.
That might give you a clue.
Reply all
Reply to author
Forward
0 new messages