Problems getting services and characteristics in Android app

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HeGa_3926896
Level 1
Level 1

Hello,

I have developed an app for iOS and Android to use BLE.

If I use iOS app there is no problem, I get all the services and I can read and write all the characteristics.

The problems begin when I use the Android app because I can´t get all the services.

I tried to get the services with CySmart app and this problem also happen.

Any ideas why this happens?

Thanks,

Héctor

0 Likes
1 Solution

This looks like a problem with the default generated UUID values. Please refer to the following KBA and change to a different UUID and it will work; PSoC 4 BLE Troubleshooting Guide – KBA220490

Regards,

Dheeraj

View solution in original post

0 Likes
11 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello Hector,

Please connect your phone via USB to your computer. Then run the app till the point of error. You will see the logs in the Logcat window of Android Studio. Share those logs so that we can have a better insight into what's going wrong.

Also, do let us know more about which Android phone you are using.

Regards,

Dheeraj

0 Likes

Hello Dheeraj,

Thanks for your response.

The Android phone is a Huawei P9 Lite.

pastedImage_0.png

This is the logcat after i try to get the characteristics.

I achieve to get some of the services and the characteristics but not all of them.

0 Likes

The error is occuring because the UUID is null. Please set a breakpoint at the line of code where you run getCharacteristic() and run debug. Check if you see the UUID parameter or not. Analyze the code to fix the errors accordingly.

Regards,

Dheeraj

0 Likes

The UUID I use is the one that I have set in the BLE module that I'm using, CY8C4247LQQ-BL483.

The problem is that the Android device doesn't get correctly two of the services I have created earlier in the BLE module and,when I try to get the characteristics of the service is when I get that the uuid is null.

One of these services with which i have problems is received by the device but without characteristics and the other one is not even received.

pastedImage_4.png

In the image above you can see 6 services, but there should be 7, and services 4 and 5 should have two characteristics, but the last one has none.

I use the same UUIDS in the app for iOS and there is no problem getting services and characteristics, I can use all of them but in Android there are 2 services that I can't.

Thanks for your help.

0 Likes

What is different about the two services which are seeing problems in Android? Can you check the configurations again in Creator? Make sure you check if it works in CySmart app as well for every alteration you make.

Please share your PSoC Creator project if possible.

Regards,
Dheeraj

0 Likes

There is no difference. I have created both the same way.

I have used CySmart app with iOS and Android and it works in the same way as my app, with iOS no problem, but with Android two services, with their characteristics, don´t work.

I will try to share the code...

0 Likes

Yes, please share your project if possible, it will be easier to debug.

Regards,
Dheeraj

0 Likes
lock attach
Attachments are accessible only for community members.

Here is the BLE part of the project.

If something else is needed, let me know.

0 Likes

Have you tried using another phone?

Regards,

Dheeraj

0 Likes

Yes, I have used a Samsung Galaxy A8.

With this phone the problems are the same.

0 Likes

This looks like a problem with the default generated UUID values. Please refer to the following KBA and change to a different UUID and it will work; PSoC 4 BLE Troubleshooting Guide – KBA220490

Regards,

Dheeraj

0 Likes