How Scan for Bluetooth Devices | Building a Bluetooth Chat App for Android | Part 1

  Переглядів 48,727

Philipp Lackner

Philipp Lackner

Рік тому

In this video playlist, you'll learn how you can build a bluetooth chat app. First, we'll start learning how to scan for nearby devices and display them in a list.
⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/premium-courses/
💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
pl-coding.com/drop-table-ment...
Subscribe to my FREE newsletter for regular Android, Kotlin & Architecture advice!
pl-coding.com/newsletter
Join this channel to get access to perks:
/ @philipplackner
Get the initial source code here:
github.com/philipplackner/Blu...
Get the final source code for this video here:
github.com/philipplackner/Blu...
Join my Discord server:
/ discord
Regular programming advice on my Instagram page: / _philipplackner_
Checkout my GitHub: github.com/philipplackner
You like my free content? Here you can buy me a coffee:
www.buymeacoffee.com/philippl...

КОМЕНТАРІ: 118
@mudso
@mudso Рік тому
OMG! Thank you sooooooooo much for touching the Bluetooth topic, really hard to find a good and updated one on youtube these days!!!!!! THANK YOU!!!!!!!!!!!!!!!!
@manuelsalas6190
@manuelsalas6190 Рік тому
Thanks Philipp!! I can't wait for the BLE app 🙌
@moeinghandehari
@moeinghandehari Рік тому
Thanks so much Philipp. Can't wait for next bluetooth tutorials :)
@pedrorivarepetti
@pedrorivarepetti Рік тому
Thank you Philip.. If you take Bluetooth LE topic please consider to read some sensor as temperature and send some conf data data to the device ...this is most common task on IoT I think.Thanks again
@0xpirate
@0xpirate Рік тому
Can't wait to build this one 🙌
@EmmanuelMoralesonair
@EmmanuelMoralesonair Рік тому
Excellent video, thank you very much! I would love one but with BLE devices
@hansworry
@hansworry Рік тому
Greetings, Philip. Success is always my new subscriber. Your tutorial is very helpful, thank you very much, I hope the knowledge is useful and I am from Indonesia very proud. Hopefully 1.5 million subs quickly
@austinduran763
@austinduran763 Місяць тому
Thanks a ton! Would love to see a BLE video along with GATT and Characteristics!
@Sara-oy6ly
@Sara-oy6ly Рік тому
Thank you so much for this🙂
@pcfilho7720
@pcfilho7720 Рік тому
Thank you so much for teaching about Bluetooth, i need to use it on my job and it was always a pain to look for something about it on the internet, would really appreciate if you make more content envolving these IOT topics! Great job! 😁😁
@hyprobablyausto
@hyprobablyausto Рік тому
for real tho ....the android developers site had docs that were deprecated and that was fucking stuuuppiiiddd
@joshflugel
@joshflugel 2 місяці тому
I would definitely be interested on a vide for BLE with MVV and Clean architecture. I am coding as similar app, but it uses BLE Bluetooth Low energy to communicate through a communication channel made up by arduinos on each peer end, that communicate with LoRa in between them. The idea is to extend chat range from a few meters with BLE to 1-3 kilometers with LoRa. So stoked to watch this video.
@zoolkeda2915
@zoolkeda2915 4 місяці тому
Man, you made my life a better one!
@marshallladd
@marshallladd Рік тому
Amazing as usual. Would love the BLE version as well.
@MatheusFaleiro
@MatheusFaleiro Рік тому
Same!
@lakshminarayanacharan837
@lakshminarayanacharan837 Рік тому
Excellent topic and waiting for BLE
@creationscaplette
@creationscaplette Рік тому
Thanks a lot for the videos. I would also be interested in the ble version :)
@Adam0001
@Adam0001 Рік тому
Amazing Thank you so much
@kl3jvi
@kl3jvi Рік тому
I also build a new app for ble device scanning. One issue with continue scanning of devices is that it always show new devices but i wanted to add them to recyclerview. I used flow scan() operator. Hope this helps.
@rikonikotako
@rikonikotako 5 місяців тому
Thanks a lot, Philipp! This video was absolutely useful and perfect. Tomorrow I'm going to watch second one. Because I need it for my current little project at work .-.
@user-vq1vi2fj9z
@user-vq1vi2fj9z 29 днів тому
bro can you tell me where is xml code of this ?
@seanknowles9985
@seanknowles9985 11 місяців тому
Can we use intellij for android development, I seem to always run into editor version issues. I also really don't enjoy having to constantly switch between two weighty programs for backend server-side work and Android. It would be ace to be able to setup on editor for all the kotlin and android work.... any guidance would be great?!
@dzartxstudio
@dzartxstudio Рік тому
Thank you ❤️
@Felix-3737
@Felix-3737 Рік тому
So nice!! Big thanks for your amazing work. Love all your videos and already bought your KMM course which is extremely helpfull! A video about Bluetooth low energy would be amazing as well. For android there are already quite some big libraries (e.g. nordic semiconductor ble android library) which makes things a bit easier. Now I've seen there are also some libraries for Ble for KMM. Would be interesting to see a video about how you would approach a KMM Bluetooth or Ble app. With libraries or is it better to do it from scratch? Is there much code that we could share or is the bluetooth stuff too platform specific? Looking forward to watching the next videos and shorts!
@johangarrido-mg2nt
@johangarrido-mg2nt Рік тому
Yeah it would be awesome!!
@namrathas5804
@namrathas5804 2 місяці тому
Thank you for the tutorial Philip. Can you please make a tutorial for BLE as well.
@novascotia2015
@novascotia2015 Рік тому
100K. Congrats
@jagorkushnir2079
@jagorkushnir2079 Рік тому
awesome, man! I wish to se your ble tutorial
@Ibroximjon-techie
@Ibroximjon-techie 4 місяці тому
Good job bro. I appreciate your work. Thank you. What about getting data from bluetooth devices like headphones or cameras. I hope someday you will make a video about it,
@hyprobablyausto
@hyprobablyausto Рік тому
i cant believe it..... i cant...no ....this isn't real 😭🤩❤❤❤❤...phillip lackner is officially the android dev GOAT...this ...this...this.....dude you are too muccchh....thanks man
@priyamprakash1209
@priyamprakash1209 4 місяці тому
Hi Please Make a video on Bluetooth Low Energy Integration also. There are not much content available on you tube . Thanks !!
@Designguidetv
@Designguidetv 8 місяців тому
would love to hear about how to do this with ble
@venkatesh4307
@venkatesh4307 8 місяців тому
Thank you
@khapp7821
@khapp7821 Рік тому
can we add hilt by gradle dsl instead use in classpath?
@user-kd7wm9ih7i
@user-kd7wm9ih7i Рік тому
Hi Philip, Great tutorial on Bluetooth. Also, it would be really great if could also make a tutorial on Bluetooth LE and also using XML instead of compose, or just show both of the implementations. Thanks a lot by the way.
@wagnerarcieri
@wagnerarcieri 11 місяців тому
I doubt he would make an XML tutorial ever again
@jared4670
@jared4670 4 місяці тому
To the best of my knowledge, this type of functionality is only available with Bluetooth Classic/Serial and is not possible with BLE devices.
@benjamintorres725
@benjamintorres725 3 місяці тому
this is awesome
@luix7099
@luix7099 11 місяців тому
Please do the LE version. it will be very appreciated
@Ayor88
@Ayor88 17 днів тому
bluetooth low energy (BLE) tutorial would be very appreciated !
@braisonorina3922
@braisonorina3922 6 місяців тому
hey what keyboard shortcut are you using to create new files
@VS-le2ep
@VS-le2ep Рік тому
Guys, I see the his project structure tree "Java - com - plcoding - bluetoothchat etc", is this requered condition or it's possible to use regular structure? Like you create new Empty Activity Project where's MainActivity located a bit another way, not like in the video
@events4089
@events4089 Рік тому
Bro please make a video about sharing ui jetbrains compose across Android and iOS in kmm
@jatinkashyap4075
@jatinkashyap4075 7 місяців тому
Is it possible to change the mac or ip address of an earbud?
@1234spica
@1234spica Рік тому
Please do for BLE too. 😀
@DayZilya
@DayZilya 8 місяців тому
Has anyone figured out why the code (event from github repo) is not working on Android 10 API 29? Is there a way to make it work?
@disturbingsoundsoff
@disturbingsoundsoff 8 місяців тому
I just ran into this problem myself. I managed to get it working on android 11 and 8.1 and wrote a comment about how i did it. You can look for it if you're still having trouble.
@rubinundhad420
@rubinundhad420 11 місяців тому
hey, nice video, please guide me. i want to develop app which enable to play music on multiple bluetooth earphone. thanks.
@mathias0584
@mathias0584 Рік тому
Hey man, by chance do you know how to code apps in Kotlin that can take screenshots? I don't mean the window.decor.root that captures the activity, I mean that will take a snapshot of whatever is on the device's top screen whether it's the app, facebook, their web browser, etc? What I am trying to develop is an app that takes a picture from an image view and copies the text in the image. I have that text recognizer part figured out. I am good there. What I can't figure out is how to take external snapshots. I put a foreground service in my app with a notification channel, and I named one of the action button's on the notification "Take Screenshot". What I want this to do is, close the notification panel, and then take a screenshot of whatever is on the device's top screen this could be the app, facebook, web browser, etc. When the screen shot is taken, I want the image to return to the app's main screen where the imageview is and display there, and then I call my text recognizer to copy the text from within the picture. So, let's say I want to copy a text from a web browser that I can't select and copy. All I have to do is, pull down the notification panel, find my notification service, and click on take screenshot, the notification panel goes away, then it takes the screenshot, and then lastly it will return the result to the imageview of my application so I can copy the text. I hope this all makes sense. I've been trying to look up how to take screenshots, and all I can find is the ones that takes screenshots of the application. There's hardly any tutorials available on what I am trying to do here. I appreciate it if you can and will help me with this! I am willing to pay you $25 for the tutorial if it's too much to ask.
@shreyaspatne8754
@shreyaspatne8754 Рік тому
hi Philipp great content, one issue my device SDK version is 30, it didn't popup to ask for enable Bluetooth, or even after doing it manually app neither show paired nor scan devices, when I debug it says permission not granted, letter I download your code and run still same issue.
@jliang2257
@jliang2257 9 місяців тому
Hello. Were you able ever to fix this issue? I am running into the same error, and I cannot update my device SDK as of now.
@adamobranz5052
@adamobranz5052 9 місяців тому
@@jliang2257 I also have the same problem, the fact is that in the main activity, if the Build.VERSION.SDK_INT is less than Build.VERSION_CODES.S then it doesn't launch any permissionLauncher.launch, I tried to put an else block putting permissionLauncher.launch (arrayOf( Manifest.permission.BLUETOOTH_ADMIN Manifest.permission.BLUETOOTH) and then in AndroidBluetoothController check the versions and call the hasPermission method with permissionToCheck set to the right permission. But even so it doesn't work
@user-ie7tt3cf6f
@user-ie7tt3cf6f 7 місяців тому
yes it does not work@@adamobranz5052
@faizannazir5596
@faizannazir5596 Рік тому
create tutorial for smae app using uart ( mobiles connected through wire)
@subhashpandey3038
@subhashpandey3038 6 місяців тому
Hey Philip, it would be great if you made the video on the BLE.
@NeerajSingh-oc5hu
@NeerajSingh-oc5hu 5 місяців тому
Have u made any project on it?
@matthew_0205
@matthew_0205 Рік тому
Can you do one which uses a local wifi.
@syedabuthahir2421
@syedabuthahir2421 Рік тому
it is not working below android 12
@henry9361
@henry9361 3 місяці тому
Is it possible to build an app with html and javascript and use Bluetooth with it?
@_AverageGuy
@_AverageGuy Місяць тому
For those facing issues where the scanned and/or paired device list is showing nothing and your device is lower than API 31, the reason is in the condition *(!hasPermission(Manifest.permission.BLUETOOTH_SCAN)) return or (!hasPermission(Manifest.permission.BLUETOOTH_CONNECT)) return* Since these permissions were added in api 31, for lower apis the result will be false and thus the functions will simply return and not execute further. Update the condition like this: if ( (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) && your_permission_check) { return } so that devices with api lower than 31 are not checked for this permission. Hope this helps :)
@SpaceTimeBeing_
@SpaceTimeBeing_ Рік тому
Hey man, can you do something with native c++ code? Some companies ask for experience with this, but I'm unable to figure out what I can do with c++ today in android
@nantiyachomtee2998
@nantiyachomtee2998 Рік тому
I'd recommend to check out QT / Qml for Android.
@adarshtechstore
@adarshtechstore Рік тому
Hello, I am Adarsh. Application not working. I Try Developing Application as your video but not working. i am feeling like somewhere i made mistake so i try your github repository but it's also not working. Error 1 : Not Show Bluetooth Permission in About Application ( Android 10 or Less )
@DayZilya
@DayZilya 8 місяців тому
Did you find a way to make it work?
@UNFORSEEN_DANISH
@UNFORSEEN_DANISH Рік тому
How to make unique layout on xml
@mohammadbassam1560
@mohammadbassam1560 11 місяців тому
how can i run 2 environment in the same time
@olubakinboaz3194
@olubakinboaz3194 Рік тому
Sorry please i want to ask if it is only for android
@adamobranz5052
@adamobranz5052 9 місяців тому
Is the app not working for me only? Basically it doesn't ask for permissions at startup and then the hasPermission method always returns false
@jared4670
@jared4670 4 місяці тому
Yeah that's what I've found as well and then I found a thread the other day on stack overflow stating that you will not receive a permissions dialogue and commenting out my permissions check enabled me to successfully scan for Bluetooth devices
@denisk3852
@denisk3852 Рік тому
Does it work with iOS devices?
@youngtigersivateja
@youngtigersivateja Рік тому
Hi Phillip, in you premium courses the cost is showing as 259,00€, is this 259.00€ means 259€, etc?
@PhilippLackner
@PhilippLackner Рік тому
Yes
@jatinsingalEARCS
@jatinsingalEARCS Рік тому
we are interested in Bluetooth low energy
@wagnerarcieri
@wagnerarcieri 11 місяців тому
Hey Phillip, I was trying to follow this tutorial, but for Android 10 that is my device, and I cannot "scan" for the NOT paired Devices... Tried for 2 days, BLUETOOTH_ADMIN permission, Background... coarse and Fine location... runtime permissions... nothing worked.... any idea to make it work ?
@khushboochaudhari5206
@khushboochaudhari5206 10 місяців тому
Did u find the solution??
@wagnerarcieri
@wagnerarcieri 10 місяців тому
@@khushboochaudhari5206 No, I was not able to
@DayZilya
@DayZilya 8 місяців тому
Have you found a solution?
@wagnerarcieri
@wagnerarcieri 8 місяців тому
@@DayZilya I did not tried again
@DayZilya
@DayZilya 8 місяців тому
Damn, I mean, there should be a way to do it, but it seems that no one found out how@@wagnerarcieri
@germenwong
@germenwong 4 місяці тому
Why scanning operations cannot be performed on Android 10? Who can answer this question
@user-vq1vi2fj9z
@user-vq1vi2fj9z 29 днів тому
where is XML code can anyone tell me?
@mymobile550
@mymobile550 Рік тому
Sorry I didn't watch the video. But I already tried this but I don't have multiple devices to test the app 😔 . Is there any way to use an emulator as the second device.
@simonwambua3710
@simonwambua3710 Рік тому
I dont think you can use emulator for ble
@ismailhossain964
@ismailhossain964 Рік тому
Omg Omg Omg Cant explain what wanted to comment. 🤓
@octupleplace4168
@octupleplace4168 6 місяців тому
Is it normal that when my app runs, it doesn't show any devices?
@cazterk
@cazterk Рік тому
would love to see a chat app using the nearby/share or messages api
@mg-ht9ir
@mg-ht9ir Рік тому
I'm still not using jetpack compose 👾🔥😂
@kusanaei
@kusanaei 11 місяців тому
5:20 I'm a newbie... I just day 2 into the darkness ... documentation is not newbie friendly at all.
@mahmoudalkateb2008
@mahmoudalkateb2008 Рік тому
top G ✌️
@TheZaurHasanov
@TheZaurHasanov Рік тому
👋🏻
@bdg5727
@bdg5727 11 місяців тому
Has anyone got this working after upgrading to flamingo?
@Alex_Hunter
@Alex_Hunter Місяць тому
Unfortunately this was too complex for me to follow as someone who is new to kotlin
@MuhaamdSajid
@MuhaamdSajid Рік тому
its work on android version 10 and not working on android 11 and greater
@PhilippLackner
@PhilippLackner Рік тому
My devices are running on the latest android version
@VS-le2ep
@VS-le2ep Рік тому
@@PhilippLackner so could you recommend something to use it with android 11?
@AndreaBonatti
@AndreaBonatti 11 місяців тому
@@VS-le2ep I think the problem is the new flag used in the manifest that work only for the new android version (android version >= 12), so you need the ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION for the lower version
@VS-le2ep
@VS-le2ep 11 місяців тому
@@AndreaBonatti only manifest? no checking like try-catch in mainactivity?
@AndreaBonatti
@AndreaBonatti 11 місяців тому
@@VS-le2ep They are both dangerous permissions so you need to require and check them
@rodrigocespedesgonzales1073
@rodrigocespedesgonzales1073 8 місяців тому
Ble pls
@ramakrishnavelisetti5078
@ramakrishnavelisetti5078 Рік тому
Hi Phililip you made this video ukposts.info/have/v-deo/fXZkZ4GksKajpoU.html for getting data from retrofit will you please make a video of post data to the API using retrofit. and for login also using retrofit after login if we open the app it has to open home page instead of login page because he is already logged in will you please
@GN9K71
@GN9K71 Рік тому
Shouldn't bluetooth scan business logic be put inside 'UseCase' or 'Manager' class, instead of controller. Controller is part from MVC-pattern, according to which, the controller is awared about the view, on the other hand Viewmodel must don't know anything about the view it works with.
@PhilippLackner
@PhilippLackner Рік тому
This is not related to MVC, I just think Bluetooth controller communicates the purpose of the class well. In this app there's no business logic involved. Scanning is data logic
@GN9K71
@GN9K71 Рік тому
@@PhilippLackner The video is very nice! Yes, you are right business logic should be related to domain ot presentation one. I was just wondering why did you choose to name the class controller?
@PhilippLackner
@PhilippLackner Рік тому
@@GN9K71 because the class controls the Bluetooth adapter
@laetitia5578
@laetitia5578 2 місяці тому
14:58
@abdullah-hz9yi
@abdullah-hz9yi 17 днів тому
The code is long
@penttiitkonen9765
@penttiitkonen9765 10 місяців тому
I just state that programming Android Bluetooth is not the area of a beginner! 😬
@devstuff2576
@devstuff2576 11 місяців тому
getting error broadcast receiver not registered
WorkManager - Android Basics 2023
34:22
Philipp Lackner
Переглядів 43 тис.
Зомби Апокалипсис  часть 1 🤯#shorts
00:29
INNA SERG
Переглядів 1,3 млн
Анна Трінчер - Бар за баром (Official Music Video)
02:38
Анна Трінчер
Переглядів 1,8 млн
ЧТО ДЕЛАТЬ, ЕСЛИ НЕ ХВАТАЕТ ДЕНЕГ НА ВОССТАНОВЛЕНИЕ ТАЧКИ?
47:52
L20 | Java | String | Part 3 | Bangla
11:27
Learn With Tawhid
Переглядів 79
Does Native Android Development Have a Future?
5:08
Philipp Lackner
Переглядів 37 тис.
Big Tech AI Is A Lie
16:56
Tina Huang
Переглядів 36 тис.
Deep Linking in Jetpack Compose
4:15
Daniel Atitienei
Переглядів 3,5 тис.
Rabbit R1: Barely Reviewable
19:53
Marques Brownlee
Переглядів 6 млн
Master BLE Basics in Just 10 Minutes: The Ultimate Guide!
9:15
Novel Bits
Переглядів 86 тис.
Most overpowered way to build mobile apps?
8:33
Beyond Fireship
Переглядів 670 тис.
The PERFECT Laptop for Students/Work - Affordable Performance
16:33
Andres Vidoza
Переглядів 54 тис.
Зомби Апокалипсис  часть 1 🤯#shorts
00:29
INNA SERG
Переглядів 1,3 млн