Android Studio "Bluetooth Le Gatt" sample

Post questions and issues with Concept2 PM3 SDK
Post Reply
david6b
Paddler
Posts: 7
Joined: January 14th, 2015, 10:23 am

Android Studio "Bluetooth Le Gatt" sample

Post by david6b » November 11th, 2019, 3:35 pm

I have Android Studio 3.5.1 and was hoping that the included sample "Bluetooth Le Gatt" described here would allow me to connect to a PM5....the sample code scans for nearby BLE devices, but even though my PM5 is switched on and set to the "Select this PM5 ....." screen that appears when you pick "Turn Wireless On" I don't get anything returned to the sample app.

Has anybody managed to get this to work? Or am I barking up the wrong tree? (I want to write an Android App that can communicate wirelessly with the PM5)

Thanks in advance

David

User avatar
tijmenvangulik
500m Poster
Posts: 56
Joined: November 25th, 2012, 10:24 am

Re: Android Studio "Bluetooth Le Gatt" sample

Post by tijmenvangulik » November 13th, 2019, 2:19 pm

Looks like the right tree to me. Most of the time there is a little detail wrong. Maybe the permissions. More details are needed to see what is wrong.

Tijmen

david6b
Paddler
Posts: 7
Joined: January 14th, 2015, 10:23 am

Re: Android Studio "Bluetooth Le Gatt" sample

Post by david6b » November 13th, 2019, 3:15 pm

Having managed to create a little Android app (not connected to any external device) I thought my next step would be to extend it to connect with the PM5 via BLE - hence my question. I did come across your Javascript API which looked interesting, but knowing nothing about Javascript and wanting to refine my newly emerging Android development skills I thought the BLE sample should meet my needs, but as I say, I can't get it to see my PM5.

Then I stumbled across this page, https://bandarra.me/2017/02/20/Fitness- ... Bluetooth/ where somebody has taken a different approach that I don't claim to understand but I could access his webapp (if that's what it's called) on my phone and it does see my PM5.....so maybe I should abandon my Android plans and adopt the technique demonstrated by ANDRÉ BANDARRA

Just stumbling around looking for best technology to use, only thing I definitely want is for my app to run on android, run without cables and to connect to PM5 to read meters covered in the current workout

David

User avatar
tijmenvangulik
500m Poster
Posts: 56
Joined: November 25th, 2012, 10:24 am

Re: Android Studio "Bluetooth Le Gatt" sample

Post by tijmenvangulik » November 15th, 2019, 2:18 pm

This example only fixes the easy problem of connecting to the blue tooth events. But these events can not only a part of al the communication. The hard part is doing go get the csafe up and running and to get it working on all the platforms.

Ergometer.js (https://github.com/tijmenvangulik/ErgometerJS) will do everyting for you including usb support. If you know more about java then skipp JavaScript and directly start with typescript. This makes everything a lot easier.

But there are more libraries to choose from, including native closed source libraries from concept2.

Tijmen

angrytongan
Paddler
Posts: 24
Joined: October 30th, 2015, 11:10 pm

Re: Android Studio "Bluetooth Le Gatt" sample

Post by angrytongan » November 15th, 2019, 3:37 pm

For more browser-based solutions checkout Erg Arcade. The pm5-base sample application abstracts away all the comms so your app can just receive information from the monitor. Code available at GitHub.
Image
Male, 45, 5'11", 102kg, log.

Post Reply