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: 64
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: 64
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: 33
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, 46, 5'11", 100kg, log.

User avatar
Robt.Lee
500m Poster
Posts: 55
Joined: December 6th, 2006, 6:55 pm

Re: Android Studio "Bluetooth Le Gatt" sample

Post by Robt.Lee » December 15th, 2019, 1:04 pm

Does your implementation of the Android app pick up other BLE devices? I don't have a PM5, but I have prototyped some BLE work with HR monitors. when you issue startScan what filters are you using?
500 1:27.9 1K 3:13.6 4m 1202 2K 6:49.4 5K 18:48.6 6K 22.25.0 30m 7777 10K 37.38.4 M/2 1:22:15.0 M 2:51.03.1

Post Reply