kivy , Android and NFC permissions

260 views
Skip to first unread message

PDf

unread,
Jun 3, 2016, 10:42:14 AM6/3/16
to Kivy users support

Trying to access NFC interface in Python with Kivy launcher, and jnius, on my Samsumg S4, I try following sample:

https://gist.github.com/tito/9e2308a4c942ddb2342b

My program throws exception on :

self.nfc_adapter.enableForegroundDispatch(self.j_context, self.nfc_pending_intent, self.ndef_exchange_filters, None)

with error : JVM exception occured: NFC permission required: Neither user 10087 nor current process has android.permission.NFC.

How to give this permission for NFC ?
There is the line "android.permissions = NFC" in buildozer.spec file, but I don't know if Kivy launcher use really this file.

Best regards.

Kived Devik

unread,
Jun 3, 2016, 1:17:39 PM6/3/16
to Kivy users support
You can't do this with Kivy Launcher. Permissions are set at the app level - so Kivy Launcher would need to have the permissions for you to use them. There's nothing your code can do from within Kivy Launcher to get permission. You will need to build your own APK using buildozer+p4a to use NFC.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PDf

unread,
Jun 3, 2016, 7:05:25 PM6/3/16
to Kivy users support
Ok, but does that mean than I can not used the advantage to modify easily my code main.py and try it after just copy on the smartphone ?
So I need to build an APK package each time I do a modification.... It is not easy. I thought that kivy allow to access some sensors (accelerometer, etc...) without specific authorisation ?
Best regards.

Kived Devik

unread,
Jun 3, 2016, 7:21:23 PM6/3/16
to Kivy users support

After you've built the first APK, rebuilding is pretty quick (about 20-30 seconds on my slow laptop), if you're only changing your code.

And Kivy applications on Android are still subject to the workings of the Android OS. Our apps need permissions just like any other Android app.


--
Reply all
Reply to author
Forward
0 new messages