Xamarin BLE App for latest Android releases (12 and higher)

  Переглядів 8,236

MoThunderz

MoThunderz

День тому

This video explains a simple BLE Explorer written in Xamarin (using plugin.BLE). In essence the app is a simple version of the nRF app: It allows the user to select a BLE device, then shows all available services. Upon selection of a service it will show the available Characteristics. One can then read/write strings or register to Characteristics with "notify" enabled.
Code is available here:
github.com/mo-thunderz/Xamari...
Code was originally based on Jenx Bluetooth example, but then updated and changed to be compatible with modern Android phones (release 12 and higher): www.jenx.si/2020/08/13/blueto...
Code is written for Android Release 12 or newer. All logic is placed in Code Behind in this example.
Plugin.BLE repository (with information on adaption for Iphones):
github.com/dotnet-bluetooth-l...
Chapters
0:00 Introduction
3:14 Installation of programming environment
6:19 Enable USB Debugging on your phone
8:00 Download code from Github
8:44 Enabling Bluetooth on Android 12 or newer
11:11 App description: App.xaml
11:42 App description: Bluetooth Devices Page
18:45 App description: Bluetooth Services Page
25:38 App description: Bluetooth Characteristics Page
31:22 Notify callback function
36:50 Send and Receive functions

КОМЕНТАРІ: 51
@jabdude1263
@jabdude1263 Місяць тому
you are a great streamlined teacher. Great work!
@mothunderz
@mothunderz 29 днів тому
Thank you! 😃
@Jzrz369
@Jzrz369 6 місяців тому
Wtf❤amigo estás loco jsjsj gran video...y gracias,que prospere este canal✨😎👍
@mothunderz
@mothunderz 6 місяців тому
Thank you very much! Glad the video is useful for you!
@johnheitz7517
@johnheitz7517 Рік тому
Another Great Video, Thanks
@mothunderz
@mothunderz Рік тому
Thank you for your feedback!
@wasouthpnt
@wasouthpnt 5 місяців тому
I came for the guitar on the wall, I stayed for the 5 tutorials due to your very understandable walk throughs. 🙂 May I suggest (part 6) to show how to send a command from the Xamarin BLE App to the ESP32 and what code is needed on the ESP32 to receive a command and reply. Thanks for this series. Please let me know on part 6 suggestion.
@mothunderz
@mothunderz 3 місяці тому
Thank you for your feedback! Youre the first one to state you found my vid because of the guitar on the wall :-) Great idea for a next video. Unfortunately I am really swamped with work (thus also my late reply) and I dont get to make videos at all at the moment. So my apologies, but in the near-term I wont be able to upload anything. Hope you understand...
@akshaygaikwad530
@akshaygaikwad530 9 місяців тому
great video.
@mothunderz
@mothunderz 8 місяців тому
Glad you enjoyed it
@brayanrodriguezn.3430
@brayanrodriguezn.3430 29 днів тому
This was possibly one of the best programming tutorials I've ever seen, well explained and simple, really helped me a lot. How could we plot the data that the ESP32 sends to the app? And can we make this app to run in the background to receive data all the time?
@RickardApps
@RickardApps Місяць тому
Hi! Thank you for this walkthrough and sample code! I learned a lot more about viewmodels too! I have a couple of questions if you don't mind. If I want to build an APK from this project, could I use the PowerShell to do that? In newer versions I could just publish with clicks but it won't let me do that for Android. Is Xamarin.Essentials still used for this in newer versions? I have looked at Shiny for the ble plugin tools but I don't understand any part of his guides. I really need to build a BLE project that scans, connects and send messages to the BLE device Thank you
@ericgarcia7429
@ericgarcia7429 10 місяців тому
Thanks i'm serching a lot for do connection with xamarin
@mothunderz
@mothunderz 10 місяців тому
You're welcome 😊
@josefredo9514
@josefredo9514 11 місяців тому
Great video! I need to make an application in Xamarin using bluetooth, when a specific string is received from the ESP32 board, show a message in Xamarin, could this work with what is shown in the video?
@mothunderz
@mothunderz 11 місяців тому
Yes, this is the right code for that -> just use "Notify" and you can send any string at any point in time from the ESP32 to Xamarin.
@deonbowers6706
@deonbowers6706 11 місяців тому
Before I go down this route, I was wondering if this would allow me to send a signal to my ESP32 that starts a function that tells a dc motor controller to start, stop, reverse the motor?
@mothunderz
@mothunderz 11 місяців тому
Yes, you can send a string from the mobile app to the ESP32 and thereby give the ESP instructions.
@MrChechoPVP
@MrChechoPVP 7 місяців тому
For 11 and older versions of android is the same thing just with different permissions?
@mothunderz
@mothunderz 6 місяців тому
My apologies, but I dont have a phone to test older versions with.
@user-fh4ub2gi8c
@user-fh4ub2gi8c 4 місяці тому
Thank you for the fantastic video. I tried running the downloaded code on my physical Android 12 device, but despite having Bluetooth enabled on both my headphones and Android phone, I couldn't detect any available Bluetooth devices. Can you assist me in figuring out what might be missing or needed in this situation?
@mothunderz
@mothunderz 3 місяці тому
Have you tried with the nRF app with an additional phone? See as well this video for use of the nRF app: ukposts.info/have/v-deo/aImnmJWiZ56Tt6c.html
@chrisstjohn2234
@chrisstjohn2234 7 місяців тому
You have the Central/Peripheral roles the wrong way around.... Peripherals advertise, generally contain a Server. Centrals scan, connect and generally contain a Client.
@mothunderz
@mothunderz 6 місяців тому
Yes correct, my apologies for that
@jokerjuha7515
@jokerjuha7515 8 місяців тому
Great Video. But how do I stay connected, if i leave the page?
@mothunderz
@mothunderz 8 місяців тому
There are few options around that problem. The by far easiest solution is to stay on the page and create different view by using the arrangements that are available under "layout". You can then switch these arrangements on and off with the "visible" parameter of the arrangement. Pls give that a try.
@user-ok8bu4ft8b
@user-ok8bu4ft8b 8 місяців тому
Great video, but I want to know how to change the code so that my phone can connect to an HC-05?
@mothunderz
@mothunderz 8 місяців тому
The HC-05 uses the old Bluetooth 2.0 standard and is not suitable for BLE. I highly recommend you upgrade to the HC-09. If you insist on using the HC-05 you will need to use serial Bluetooth. I have a video online on serial Bluetooth with MIT App Inventor, but have not looked into Xamarin with serial Bluetooth yet.
@user-ok8bu4ft8b
@user-ok8bu4ft8b 8 місяців тому
@@mothunderz ok,thanks,already updated to HC-08👍
@mothunderz
@mothunderz 8 місяців тому
Excellent!
@Mr767267
@Mr767267 2 місяці тому
Now that Xamarin is coming to End Of Life this year, does MAUI support the same library?
@mothunderz
@mothunderz Місяць тому
Yes, its definitely time to go to MAUI. It is all quite similar, but I have not had the time yet to look into this in detail :-/
@lucasianii8178
@lucasianii8178 5 місяців тому
Hi Sir, thanks for the video, is it possible that you create another video where we create this app in android studio KOTLIN with jetpack compose please?
@mothunderz
@mothunderz 3 місяці тому
thank you for your feedback. At the moment I am overloaded with work and unfortunately dont have time to make videos. When I have time again I can look into it.
@lucasianii8178
@lucasianii8178 3 місяці тому
@@mothunderz Alright, thank you. I hope you do some in the future.
@ashutoshjangir4918
@ashutoshjangir4918 2 місяці тому
Hii bro i love your content but i am not able to find ble mesh networking can you suggest me
@mothunderz
@mothunderz Місяць тому
What do you mean with "ble mesh networking"?
@JiaJiaVlog
@JiaJiaVlog 11 місяців тому
I have something very confused about bluetooth searching, which is that I can only get the device paired before and can not find the new unpaired device on my app. And I can not figure out why. Is there anyone that can answer my question. I would be appreciated
@mothunderz
@mothunderz 11 місяців тому
Thank you for your comment. If you connect to lets say a Bluetooth speaker: do you do that in the app, or do you do that by pairing it in the general settings? In most cases you pair in the general settings and the app automatically sees that the right device is paired. For this video I show the list of available Bluetooth devices in the app as demo, however, in the "real app" you would not do that. Instead you should just scan through all available Bluetooth devices automatically and check if the UUID matches. If it does, you can automatically connect to that device. So in practice the user pairs the device in the general settings and the app automatically connects. Good luck with your code!
@JiaJiaVlog
@JiaJiaVlog 11 місяців тому
@@mothunderz The available devices you mentioned means devices have already paired in the general setting or not. I am very confused with that. And thanks for answering my question
@mothunderz
@mothunderz 8 місяців тому
Sorry for my late reply: I missed that you answered. Yes, I meant the devices available in the general settings.
@ericgarcia7429
@ericgarcia7429 10 місяців тому
I using de APP for serch diferents divices bad somtims don't see for exple i use antenna BLE HC-05 with pico and can't connect i don't see the divce. Do know how up program for see this divice.
@mothunderz
@mothunderz 10 місяців тому
Working with BLE is not very straightforward. There can be many reasons why you dont see a device at some point in time. What I suspect though is that you are trying your code and dont realize the pico is still connected. Resetting the pico should solve that problem. However, it could be tons of other problems. For me to figure out what is wrong from here is virtually impossible. Good luck with you project!
@ericgarcia7429
@ericgarcia7429 10 місяців тому
Thank you for all
@akshaygaikwad530
@akshaygaikwad530 9 місяців тому
hindi link for available sir plzzzzzz
@mothunderz
@mothunderz 8 місяців тому
My apologies, but I am not sure what the request is
@phamngocquapham5472
@phamngocquapham5472 3 місяці тому
Thanks for your video. But one problem is that I can't find the code for "BLEPermission". Can you help me please.
@phamngocquapham5472
@phamngocquapham5472 3 місяці тому
@phamngocquapham5472
@phamngocquapham5472 3 місяці тому
oh i'm really sorry. I found it
BLE with ESP32 tutorial part 1: the Server
25:23
MoThunderz
Переглядів 70 тис.
Create your own App! Control an ESP32 (Arduino) via Bluetooth - Part 1
18:18
skibidi toilet 73 (part 2)
04:15
DaFuq!?Boom!
Переглядів 28 млн
Піхотинець - про рутину на фронті
00:46
Суспільне Новини
Переглядів 303 тис.
App Devlog 1 - What Could Possibly Go Wrong?
14:17
Logan Koshenka
Переглядів 173
i cant stop thinking about this exploit
8:40
Low Level Learning
Переглядів 131 тис.
Xamarin Debug App On A Physical Device
8:35
Rabi Gurung
Переглядів 22 тис.
Why Building a C++ Component in Unreal Engine is Easier Than You Think!
12:24
Scripted Adventure
Переглядів 16 тис.
Add a BottomSheet to Your .NET MAUI App with This Amazing Plugin!
14:51
Gerald Versluis
Переглядів 11 тис.
Plugin.BluetoothClassic for Xamarin. Tutorial. IBluetoothConnection
32:05
Электротехника для программистов :: Практика
Переглядів 8 тис.
Flutter vs .NET MAUI | Which is better ?
6:38
AI with Flutter
Переглядів 16 тис.
How to use a Rotary Encoder with an Arduino - CODE EXPLAINED!
21:11
MoThunderz
Переглядів 27 тис.
Master BLE Basics in Just 10 Minutes: The Ultimate Guide!
9:15
Novel Bits
Переглядів 87 тис.
skibidi toilet 73 (part 2)
04:15
DaFuq!?Boom!
Переглядів 28 млн