Тёмный
No video :(

Using a Realtime Database in Python (Kivy) using Firebase 

Petar Luketina
Подписаться 227
Просмотров 25 тыс.
50% 1

The code is in my GitHub, along with the buildozer.spec file: github.com/Pet...
Remember to type with double quotes in the text field.
To see a robust example of what Python code and Firebase can achieve, check out my recent app on the Google Play store. I created my own real-time leaderboards using Kivy's Recyleview: play.google.co...
Happy coding! 🤓🖥

Опубликовано:

 

24 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 109   
@erik-sandberg
@erik-sandberg 5 лет назад
This is awesome! I just started using firebase in December for an iOS app as well. Cool to see someone else had the same idea! You should make another video showing people how to use more of firebase's REST API to query data by certain keys and like upper/lower limits.
@PetarLuketina
@PetarLuketina 5 лет назад
That's cool to hear! If your app is finished, feel free to post a link to the App Store page. I always like to promote and look at what other developers have created with Kivy. EDIT: Yes, when we work with large data sets, It would be much smarter to query the database for a specific data point instead of downloading it all then parsing through it in Python. Having the database do the work will cut down on the bytes downloaded. Another way you can save on data is by specifying the URL too when you query the database. Although, we do get 10GBs of reading and writing, which is more than enough for my projects. If you plan on making having many users with a lot of data, querying the database is worth doing
@ron-davin
@ron-davin 4 года назад
Hey Erik, I watch your tutorial videos. They're great :D
@acework9719
@acework9719 2 года назад
the tutorial is awesome. I tried for weeks to convert data to json before I could send it to firebase. Thanks bro.
@yashmehta7196
@yashmehta7196 4 года назад
I am pretty late but this video helped me a lot ❤️ so thank you so much. Was trying to figure out how to make an apk but was stuck, your suggestion of using request module instead of firebase really helped me out. Also if you are reading this I wanted to update that when importing request module , the buildozer spec file requirements section will include requests,urllib3,chardet,idna So if anyone is stuck while building and deploying apk add these dependencies to the requirements list Also logcat helped me alot to find the missing modules
@endhesyamsuar1830
@endhesyamsuar1830 4 года назад
thanks a lot, it's help me out of my issue
@shubhoum
@shubhoum 2 года назад
Thank you soo much wasted 2 days searching in google at last found this and it worked!!!
@HelloWorld-fh2ge
@HelloWorld-fh2ge 2 года назад
He bro, just to have the data in back side without use the dictionary in TextInput, you can store the TextInput value in a dictionary and use : request.post(url=firebase_url, json=json.loads(json.dumps(the_dictionary_that_store_data))) So thank you for the video, it really helped me...
@felipegerhardt8600
@felipegerhardt8600 3 года назад
Thank you for this lecture my bro.
@Lucas-gg9yb
@Lucas-gg9yb 4 года назад
Please, make a tutorial for kivy recycle view to run a table with the data from database. Nice video.
@EduardoCCorrea
@EduardoCCorrea 5 лет назад
Thank you, your video helped me a lot, I wanted a video of the part that did not show turning into apk. Like and favorite
@Altohamy
@Altohamy 4 года назад
check my channel you will find that video
@pushkardey
@pushkardey 4 года назад
its a little but..if you are on Linux, you can use buildozer
@sksahil4374
@sksahil4374 3 года назад
Thanks
@borneoviral6379
@borneoviral6379 Год назад
looking for latest version of this tutorial
@gigamgamboa828
@gigamgamboa828 Год назад
hi! just subscribed. question sir. in "GET" how to select just 1 row data? like for example i just want to select the PARENT1 data. hope you can reply. TIA
@mntiv
@mntiv 5 лет назад
Thanks for the video. May I ask what editor/IDE are you using?
@PetarLuketina
@PetarLuketina 5 лет назад
You're welcome! I use PyCharm Community edition. There is a way to have .kv files show the different colors but I never had success setting that up.
@opposite342
@opposite342 5 лет назад
I use Atom and they recognize kv files, but the problem is the need to setup new virtual environment for library through cmd and run the py file from there
@naveenkumarm7339
@naveenkumarm7339 3 года назад
Great ! Can you please list out few most popular apps developed using Kivy with firebase and is best idea to develop mobile apps using Kivy in terms of quality and performance ? It helps me to continue with Kivy
@jimkeen7674
@jimkeen7674 4 года назад
Seems like post would be useful if you have many users. I suppose the app could save that random folder name as a string and call that data with it for that specific user?
@maxpershin3735
@maxpershin3735 5 лет назад
Hi! Thank you for your outstanding video. I've been creating my project and was in desperate need of something like this, so your video was 1000% helpful anwsering all the question I had about using Firebase this way. I already wrote some algorythm to my app, and it works well on my PC. But it aint on my phone. I think the problem caused by my buildozer spec file - probably I don't have some requirements needed, or something else. Could you please specify your settings in spec file, so I could have idea what is missing. I know I could use android logs to find it out, but for some tech reason they are unavaible for now, so I should only work blindly. About my app: It turns on, but when I push my sync button (which downloads data) my app crashes.
@sisyphus6852
@sisyphus6852 3 года назад
I keep getting a connection refused by server from my android but not my pc how can I solve this?
@PetarLuketina
@PetarLuketina 3 года назад
I'd see if you have the proper permissions, and your buIldozer looks as it should, etc.
@priyanshipatel8709
@priyanshipatel8709 3 года назад
Sir, I am getting error ImportError: cannot import name 'App' from partially initialized module 'kivy.app' (most likely due to a circular import) (C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-packages\kivy\app.py) please tell me what should I do?
@PetarLuketina
@PetarLuketina 3 года назад
Hello. This is a general error not from my tutorial. The error is saying that you cannot import "App". In your code, you might have written "import App" which you cannot do. You should remove "import App"
@priyanshipatel8709
@priyanshipatel8709 3 года назад
@@PetarLuketina Thanks a Lot!! :-)
@loldjygermain3428
@loldjygermain3428 2 года назад
thank you for this amazing video Dear, i see you used python2.7 for this app, is posible to use python 3 to do the same thing, because i have been trying to use python3 but the application keep crashing in my phone, is think the issue is in the buildozer file but i can't figure it out. can you please help me figure that out ?
@PetarLuketina
@PetarLuketina 2 года назад
This would work in Python 3. You could test if my code is the problem by removing the code then compiling the file. If it works, then it’s an issue with the requests library. But I think your issue is a general one where you cannot compile it properly at all, to which I’d say that I cannot help you since it’s been over 3 years since I compiled my last app. I would reach out to the kivy community.
@loldjygermain3428
@loldjygermain3428 2 года назад
@@PetarLuketina Hello Dear! thank you for your quick response but i just figured that out by set up the requirements in buildozer like that requirements = python3,kivy,kivymd,pillow,requests,openssl,android,futures,idna, urllib3, chardet, certifi
@bishantadhikari3440
@bishantadhikari3440 4 года назад
i tried printing the get response it printd response 200 but i use patch fxn in requests and patch through it but it doesn't show up in the database , rules turned true
@PetarLuketina
@PetarLuketina 4 года назад
If it helps, you can send me your code snippet in a private message and we can fix it together.
@adamh2250
@adamh2250 5 лет назад
What version of Kivy is this in? Getting "TypeError: 'NoneType' object is not subscriptable" issues with 1.10.1 python 3. Anyone know a fix?
@PetarLuketina
@PetarLuketina 5 лет назад
Hey Adam. I'll check the version soon, but in the mean time, which object is throwing the error?
@maxpershin3735
@maxpershin3735 5 лет назад
By the way sorry for disturbing - I was using my youtube app, So I didn't see that you posted all the links :(
@PetarLuketina
@PetarLuketina 5 лет назад
Yes, I should have said so in the beginning instead of the end! But it's better to write the code out and focus on what's being written than copy and pasting. It leads to better understanding of the code, at least for myself 👍
@maxpershin3735
@maxpershin3735 5 лет назад
@@PetarLuketina Yes, you absolutely right - without thoughtful coding there is no progress in programming. By the way, if someone is watching this one with same issue as mine - at first, I missed 'android' in requirements, but when I added it to my .spec files requirements my buildozer just started throwing some errors. Solution was to just delete buildozer, downgrade cyton and install buildozer from scratch. Once more thank you Petar for your video and your reply - It was really a bless for me to find information I needed in such easy example. I know that I could learnd it probably by storming Firebase knowledge base, but I just wanted to focus more on my app and its solutions and ideas rather than spreading my time and attention on every single aspect.
@tuanazzam5172
@tuanazzam5172 4 года назад
can we directly use 'import firebase' and use its functions to build mobile app instead of importing requests and json??
@PetarLuketina
@PetarLuketina 4 года назад
I'm sure you can for a regular script but some people say they had trouble compiling.
@tuanazzam5172
@tuanazzam5172 4 года назад
@@PetarLuketina Yeah, I faced same problem. I just wanted to make sure. I think your way is the only way it works...Thanks...
@Cassio-uc2pq
@Cassio-uc2pq 4 года назад
Hey i got an error, "path p4a.source_dir does not exists"
@PetarLuketina
@PetarLuketina 4 года назад
Hello. When did you get this error? Which line of code triggered the error?
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
Can u pls tell how to connect a firebase key or value with a label text in kivy pls tell me . I have no other choices . why do I ask this is whenever I change that key or value eventually that label text also must change according to that pls help me
@PetarLuketina
@PetarLuketina 4 года назад
Hey, unfortunately, this is a Kivy question, and I stopped coding in Kivy. I don't not even have a coding environment for it. Kindly try Stackoverflow.
@yashmehta7196
@yashmehta7196 4 года назад
I am not sure , but one way you can do that is by storing the json value from firebase in a string variable [ str ], and then using object property in your python function , you can do your_label_id.text = str
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
@@yashmehta7196 thank you
@opposite342
@opposite342 5 лет назад
Hey I know this is not really about the vid that much, but I've been trying to do something similar to this. However, I can't get buildozer to make an APK. It said it can't execute Aidl when I try to "buildozer android debug deploy" it. I wonder if this ever happen to you and if not do you know a way to solve this? I've been going all over every forums, and they didn't help me at all. I would be very appreciated if you reply to this comment!
@PetarLuketina
@PetarLuketina 5 лет назад
Hey, I *think* I had the same error because when I searched for the error, my browser showed that I previously clicked on it. Does this answer the question: askubuntu.com/questions/930460/aidl-not-found-please-install-it . You probably saw that, right? It's been so long since I did a deployment, sorry! I know the deployment is the worst part of the coding process... You said that you see the error when you try something similar, meaning that you can do a simple "Hello World" app without a problem? It looks like it would be a requirement issue, or maybe something with your buildozer.spec file. Did you copy my buildozer file from GitHub?
@opposite342
@opposite342 5 лет назад
@@PetarLuketina I just found the solution. It's because I'm using raspberry pi to do the buildozer (I don't have any other Linux OS computers), I need to download Aidl for Raspbian and then replace it manually. I guess I need to install Linux on my computers soon haha.
@opposite342
@opposite342 5 лет назад
Also, keep up the good work here, your tutorial is very nice and useful!
@EliasPaiFilho
@EliasPaiFilho 3 года назад
Good night, Excellent work on this video, it eliminates outdated libraries like pyrebase. In the DELETE part I missed deleting just one document, in your video it shows the total deletion. Would it be possible to answer how the exclusion of a single document would be?
@PetarLuketina
@PetarLuketina 3 года назад
Just the top of my head, I'd get a list of all the files then perform a for-loop on each of the files and delete them. You can skip over the one you want to exclude. Does that make sense?
@locckyzywa
@locckyzywa 2 года назад
I using firebase_admin
@CMSWisCon
@CMSWisCon 3 года назад
Is it possible to do the same using Pyrebase on Android??
@PetarLuketina
@PetarLuketina 3 года назад
I don't know specifically about Pyrebase, but Android should have a library to send posts to the Firebase backend.
@Klannahar
@Klannahar 4 года назад
Nice tutorial, but your sound sometimes cut off.
@PetarLuketina
@PetarLuketina 4 года назад
Hey Klannahar, I appreciate the constrictive criticism! I learned from this video and adjusted my microphone.
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
Hey there when I already have a parent key with 2 child " child1 and child2 " and I enter a new json string with the same parent key but now with one child " child3 " it replaces the previous two child with the new one but I need to add the recent child 3 to the previous one how to add pls help me
@PetarLuketina
@PetarLuketina 4 года назад
You will need to use Patch, I believe. Which functions are you using?
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
@@PetarLuketina yeah I'm using patch but it replaces the previous one but I need to add that to the existing one
@PetarLuketina
@PetarLuketina 4 года назад
​@@dhakshnamoorthy8673 Okay, I understand what you need to do. You must add the name of the parent key to the firebase URL. For example, if your URL is "example.firebaseio.com/.json", you add the key after the ".com/" to get "example.firebaseio.com/parent_key/.json". Then you will use the patch function and it will work.
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
@@PetarLuketina thanks a lot u saved me
@mdAshikuzzamanAkash
@mdAshikuzzamanAkash 4 года назад
when i made an android app with android studio, after creating the project in firebase, i selected "for android" option to specify my app is for android. but you didn't. so dont we need to specify whether the app is for ios or android when we make app with kivy?
@PetarLuketina
@PetarLuketina 4 года назад
There are differences in how you compile the apps but I am unsure of everything you have to do because it has been over a year since I worked on mobile applications. I would ask the community or look at what the documentation says.
@mdAshikuzzamanAkash
@mdAshikuzzamanAkash 4 года назад
@@PetarLuketina ok. just tell me one thing. that ios which you created and made tutorial about that, did you compile that app both for ios and android? or only for ios?
@PetarLuketina
@PetarLuketina 4 года назад
@@mdAshikuzzamanAkash the tutorial that I showed, I complied it on Android. Unfortunately, I never compiled any apps in iOS.
@chaddlesticks4375
@chaddlesticks4375 4 года назад
Will this work if the program is built to be a smartphone application?
@PetarLuketina
@PetarLuketina 4 года назад
Yes, if you specify all the write permissions and requirements for the app.
@mdAshikuzzamanAkash
@mdAshikuzzamanAkash 4 года назад
can i use python 3 for making ios app? or i have to downgrade to python 2?
@PetarLuketina
@PetarLuketina 4 года назад
I know that Python 2 is fully deprecated. I am not sure if buildozer also deprecated the use of Python 2. When I was making apps, there was a way to use Python 3 but it required some extra steps. I am unsure if they standardized Python 3 more. That's something you'll want to ask the community.
@akshay_garje
@akshay_garje 4 года назад
How do you create apk package from kivy? I'm using windows 10 OS
@yashmehta7196
@yashmehta7196 4 года назад
I know this reply is kind of late, you cannot use buildozer to create apk package on windows. Kivy requires buildozer to build the apk , you can do that by installing a Linux VM or OSX
@kevinrios1452
@kevinrios1452 3 года назад
You can use Google Colab to package your kivy app with buildozer.
@opensourcesabout8128
@opensourcesabout8128 3 года назад
will this available when I build apk using kivymd as well?
@PetarLuketina
@PetarLuketina 3 года назад
Yes, it should. The requests library is for Python and can go on any Python environment
@mdAshikuzzamanAkash
@mdAshikuzzamanAkash 4 года назад
hey, i made an android app with android studio, after creating the project in firebase, i selected "for android" option to specify my app is for android OS. now if i make another kivy app for ios, can i use the url of that project which is specified for android? or i have to make another project?
@PetarLuketina
@PetarLuketina 4 года назад
You'll be able to use the same URL. You can post to that URL from any environment, like a command line cURL post or in a Python IDE using the requests library, etc.
@mdAshikuzzamanAkash
@mdAshikuzzamanAkash 4 года назад
@@PetarLuketina great help
@pysuhayb15
@pysuhayb15 5 лет назад
More videos please
@PetarLuketina
@PetarLuketina 5 лет назад
Hey Py Suhayb, thank you for the encouragement! I've actually taken a break from Kivy. I'm starting to learn Django, but I can make a tutorial for Kivy if you or the community needs. Just let me know what trouble you're having.
@pysuhayb15
@pysuhayb15 5 лет назад
Petar Luketina Thanks mate i have nothing in trouble with i just if can make tutorial for more resource
@PetarLuketina
@PetarLuketina 5 лет назад
@@pysuhayb15 Ah, I understand. 👍
@mdAshikuzzamanAkash
@mdAshikuzzamanAkash 4 года назад
can i deploy this kind of kivy app on apple store?
@PetarLuketina
@PetarLuketina 4 года назад
Yeah, you should be able to; however, Apple has many guidelines/restrictions that make it a longer process to publish. They also look at your app to see if it's high quality and allowed to be in their store. With the Kivy compiler, there are also a few parameters that need to be specified which are different from Android. I never published my apps to iOS for these reasons.
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
Hi I have written a kivy program using firebase and it worked well but I'm suffering a lot to convert it to an apk so I have decided to run that program temporarily by just copying it and pasting it in pydroid3 so I have installed kivy and all those stuff but also I'm getting an import error: attempted relative import with no known parent package from line " from .firebase_token_generator import FirebaseTokenGenerator " though I have not included that statement in my program pls help me to solve this u r my only choice .....
@PetarLuketina
@PetarLuketina 4 года назад
What libraries are you importing?
@PetarLuketina
@PetarLuketina 4 года назад
You can also try to remove parts of your code, the compile to see where the issue actually is.
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
@@PetarLuketina from kivy.app import App from kivy.uix.label import Label from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput from kivy.uix.button import Button from firebase import firebase Only these stuffs help me
@PetarLuketina
@PetarLuketina 4 года назад
@@dhakshnamoorthy8673 so in my video, I never import firebase. I use the requests library to speak with firebase. Have you followed the video from start to finish, or considered using the requests library? What I believe is happening is the firebase library is using dependencies that you do not have.
@dhakshnamoorthy8673
@dhakshnamoorthy8673 4 года назад
@@PetarLuketina thank you so much Thanks a lot you saved me
@sksahil4374
@sksahil4374 3 года назад
Is it safe to write firebase data base url link in Code ?
@PetarLuketina
@PetarLuketina 3 года назад
As long as it's in your backend it should be fine. I know there's extra precaution one could take to secure a variable's value which you could do if you're working with a team.
@sksahil4374
@sksahil4374 3 года назад
@@PetarLuketina In Android app if I use ..then any one can get that link by decompile my app ..
@PetarLuketina
@PetarLuketina 3 года назад
You're right. I was thinking of a backend for a webserver since I haven't worked on apps in a long time. I would try and see how others get around the fact that someone could get your Firebase credentials if they decompiled the code. Perhaps an Android or Kivy forum. I'm sorry that I couldn't be more help!
@sksahil4374
@sksahil4374 3 года назад
@@PetarLuketina okk..But @Erik Sandberg developed android app using firebase ...I don't know how he applied protection ...I want to develop some apps using firebase ...but I am thinking about security
@PetarLuketina
@PetarLuketina 3 года назад
It looks like he wasn't tagged in the comment above. I'd reach out to him via his channel or his email because he's done quite a few projects on mobile as you already know.
@jesse8606
@jesse8606 5 лет назад
hey Petar Luketina , I've made an app with Firebase and requests, but when I want to build an APK with buildozer I get an ImportError: cannot import name 'Structure' from 'ctypes' error (full error log on pastebin : pastebin.com/YGxAwbXb). If you can help me that would be wonderful
@PetarLuketina
@PetarLuketina 5 лет назад
Hey Jesse. Sorry for the late response. I didn't receive a notification from your comment. I tried to look at the pastebin but it was removed. Were you about to figure out the issue?
@jesse8606
@jesse8606 5 лет назад
​@@PetarLuketina I've solved it! The problem was that I used the default bulldozer.spec and imported firebase (from firebase import firebase) but when I use requests and your bulldozer.spec everything works perfectly. thnx
@AdityaSingh-in9lr
@AdityaSingh-in9lr 5 лет назад
Hey, I am getting a SLL error while making get request
@PetarLuketina
@PetarLuketina 5 лет назад
Hey. You already got the library via conda or pip then added it to the project interpreter, right? Please send a screenshot via pastebin so I can take a look.
@AdityaSingh-in9lr
@AdityaSingh-in9lr 5 лет назад
pastebin.com/fKKTCtjv
@PetarLuketina
@PetarLuketina 5 лет назад
@@AdityaSingh-in9lr Are you using the example code from the tutorial or have it in your own project? Please use pasteboard for a complete screenshot of the code.
Далее
Yana bir yangi qo'shiq YORAM BIYO | Yaqin kunlarda
00:57
How to store data with Python and SQLite3
9:15
Просмотров 43 тыс.
I forced EVERYONE to use Linux
22:59
Просмотров 437 тыс.
The Greenwich Meridian is in the wrong place
25:07
Просмотров 820 тыс.