b3b / able

Python for Android Bluetooth Low Energy package
MIT License
39 stars 18 forks source link

How to install? #29

Closed CineIta closed 1 year ago

CineIta commented 3 years ago

Hi, I know this is probably a stupid question, but how do I install able? I need it for an android kivy app, so I'm using buildozer, but I can't install it. I tried with pip, and by installing pythonhere, but nothing works or, at least, it doesn't show up in my module list.

juasiepo commented 3 years ago

Not on my computer right now

I remember using pip + git

Something like this: https://matiascodesal.com/blog/how-use-git-repository-pip-dependency/

El vie., 10 sept. 2021 16:43, CineIta @.***> escribió:

Hi, I know this is probably a stupid question, but how do I install able? I need it for an android kivy app, so I'm using buildozer, but I can't install it. I tried with pip, and by installing pythonhere, but nothing works or, at least, it doesn't show up in my module list.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/b3b/able/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANVOQBUGQASFEXWD3EK3CDUBIKPXANCNFSM5DZPONFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

b3b commented 3 years ago

Hi, When using buildozer, just adding able_recipe to the buildozer.spec requirements should be enough. Example: https://github.com/b3b/able/blob/master/examples/alert/buildozer.spec

Is there some kind of build error or maybe errors while importing the able module?

CineIta commented 3 years ago

Hi, I can't even import the module because I can't install it: it says "This recipe should not be installed directly, only with the buildozer tool."

I looked at the setup.py so the problem seems to be that I don't have an environment variable called 'ANDROIDAPI'. As I've already built apps with buildozer I have the android sdk folder. Should I create an environment variable with that path? If yes what path do I have to put as value? 'android-sdk' or one of the subfolders?

b3b commented 3 years ago

'ANDROIDAPI' environment variable should not be set directly, it is set by the buildozer during the build process. And the check in setup.py is to make sure that library is not installed directly: able is Android specific and there is no need to install it on the host system.

Did you use buildozer android debug command to build the application?

CineIta commented 3 years ago

Ok, I started a new app from scratch and this time it worked. I did put able_recipe in the buildozer .spec file, but the app used to crash at startup and logcat showed a python import error about able. That's why I then thought I had to install it on my pc.

It was spelled correctly even the previous times, so I have no idea why it did not work. I probably messed up something.

Now I don't get the import error, but I have to say that I haven't been able to even show bonded devices, I'll have to tinker around with it.

Thanks for the help

b3b commented 3 years ago

@CineIta Is your new app working, or maybe some problems remain? Bonded devices should be available via the BluetoothDispatcher.bonded_devices property.

CineIta commented 3 years ago

@b3b To be honest I have been busy doing other things, I started working on the project again only yesterday. Anyway, I remember using BluetoothDispatcher.bonded_devices and I think (it's been a 'long' time since) I got a Java class error or something like that. I tried it again yesterday, and it just worked. I've also managed to connect to the BLE server (finally) and read all of its characteristics. The only thing left to do now is to write new values for the characteristics, but I'm confident about it (mainly because the only difference between read_characteristic() and write_characteristic() is an additional value argument, so they should work the same). That being said, thank you very much for this amazing library, this is a big project for me and before finding it I had tried everything (including trying to learn to code 'real' android apps with Android Studio and Kotlin, but for what I need, that would have taken too long). And thanks again for the help and the interest