Insert into Firebase Database in Java - java

Is it possible to insert data into firebase Database using Java? I have created an app and want to save its data inside my firebase account.
If yes, how do I achieve this?
I read that using the SDK for android can also be used in the Java application, but I want to confirm.
I am planning to use a JS file to send data to Firebase and just call it inside the Java Application, with the Data to be sent as arguments. Still have to test this, but I'm also looking for an easier alternative.
Thank you!

Yes.
Read the docs: https://firebase.google.com/docs/admin/setup
There is the example from the Google itself: https://github.com/firebase/quickstart-java/tree/master/database

Related

What data storage should I use for storing lyrics in my app?

I'm building a songbook Android application that displays songs' lyrics that I provide and some data like how many likes it's got (user is able to like a song), etc. Something like Spotify but only with lyrics. I need to store over 700 songs and I don't know what method to choose. It would be great if I could display the data on a website in the future too.
I've heard of JSON and XML but never used it. I am familiar with SQL databases like MySQL or SQLite, but I need to store almost pure text (including new lines) with some meta data and I think a database will not be efficient. I thoght of storing txt files in SQLite BLOB format. Also it would be great if the user would not have to update the app after adding one song to the database. BUT I also need it to work when user is offline.
To this day I've only build desktop apps with no networking and no API use. I am ready to learn this so if you have an idea what should I choose, could you provide any tips how to start?
You could use SQLite to store those lyrics. According to SQLite documentation you can store string or blob with a length up to 2147483647. You could start by learning how to use room to implement the database in Android.
To add new songs, you would probably need to implement an API client, and I recommend you learn about Retrofit. Your app would check an API to determine if there is a new song and insert it into the SQLite local database.

Retrieve data from MySQL database by using Android QR Scanner

This is my first post in Stackoverflow. I'm a beginner in android and currently developing an app that uses a QR Scanner. The process is as below.
There're several objects with QR codes attached
App scans one QR code
Get the data retrieved related to that specific object (ex: name of the object, description of the object, images) from a remote MySQL database
Show the data in the app
So this is the simple process of the app. I do not know any technologies that I can use to achieve this since I'm a beginner. I would be obliged if someone could explain how I can do this.
Edit : This is different from directly calling data from MySQL database since it involves a QR code scanning part also. I can get the data from MySQL database and show it in android. But the complex part is how to get data automatically shown in the app after scanning the QR code. I have integrated Zxing QR Scanner.
Thank you.
According to your description, there are 2 main tasks you have to accomplish:
Scan QR code.
Retrieve info from a web service (which is backed by MySQL).
For (i), you would use popular QR Scanner libraries such as ZXing and ZBar. Using such libraries would require you to write some extra custom classes, just follow their instruction.
For (ii), you would use a networking library such as Retrofit, Volley, ... to get data from the web service.
Have you done any own research before asking here?
Nevertheless you can achieve your solution by trying out these steps:
1.) You need an API to scan your QR Code. By searching via Google i instantly found this page: http://code.tutsplus.com/tutorials/android-sdk-create-a-barcode-reader--mobile-17162 Here you can implement a barcode reader (but it also is able to read QC Codes as I understand)
2.) You need to find out which content the QR codes includes (e.g. an unique ID or something like that so you can identify your article)
3.) You need a database (e.g. you could use Apache Tomcat which includes a mySql database) where these IDs are stored.
4.) Your android app has to communicate with the server/database with e.g. webservices (you can google it, you will find some ways to implement webservices)
Still I can't you price "the" solution. You have to use google, read different tutorials and find out how you can solve your problem. If you are expecting difficulties you can still ask here.
I hope I still could help you a little.

How to use my own sqlite database and search through it in android?

I'm a beginner in Android development. I'm trying to make an app where you search for name and show the matching results (from a database) in a listview. Since there's a lot of data, I thought it would be best to write a database without using the SQLiteOpenHandler. So now that I have my .db file, I need a way to be able to use it in my app from the assets folder and also to be able to search through it.
I found to links which I thought could be useful.
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
This shows how to use an existing database.
http://developer.android.com/training/search/search.html
And this is Google's information on storing and searching data. I need to know is it possible to somehow combine these two methods together to achieve what I'm looking for?
You can use this extended SQLiteOpenHelper. It helps to copy the db file from assets folder in your application.

JAVA Mobile Devices - storing data locally

What is the best way to store a data set locally on a mobile device for further processing in Java?
The data set is going to be retrieved using SOAP and will consists of about 50 to 100 'objects'. Each object is like an email thread - main message followed by several updates (mainly text, occasionally graphics).
Expected actions on the 'objects':
read
add new update / send an update to the server
change status / send an update to the server
Is it better to operate directly on an xml file, implement a local data structure or perhaps use a database of some sort?
Target devices: Android & Blackberry. I would like to keep the solution as generic as possible to make it easier to reuse parts of the code the mentioned platforms.
Many thanks, Luke
It depends on you:
If you want something fast - use SQLite database or Store it in XMl File.
If you want something easy to implement (but slower) - use SharedPreferences
If you are thinking about to use SQlite or Xml file than i will suggest you to use SQlite database because you need to perform such operation on the data.so reading from xml file and again writing it to file will be little slower than SQLite database.
Hope this helps.

How can I view webpages and save data to a database using Java?

I am collecting data from a website and trying to save it to a database (or something similar that is very accessible) rather than having a heap of files on my desktop or in a folder.
There are many pages that I need to look at (1900 to be exact). I want to save time in getting this data, and decided to make a Java program to do this.
This is basically what I am trying to do.
Visit the webpage: www.TestWebsite.com/items/0
Save the (Name, Description, Image(png)) into one array/class to a Database.
Repeat until I get up to: www.TestWebsite.com/items/1899
I want to be able to access this data offline without having to need to go online to view it.
Any ideas on how I should start. I have made a basic webpage viewer, I am just missing the step in between saving the strings and images to a database.
I appreciate any help!
Actually just did this the other day. I used jsoup to scrap the webpages I needed and wrote to my local database. awesomely easy framework for webpage parsing.
It's fairly straightforward, but you'll need to learn a little SQL if you haven't already.
You'll also have to pick a database platform - I'd suggest SQLite for such a purpose, since the data is for personal use and it's lightweight and easy to set up.
Here's a tutorial on using JDBC (Java Database Connectivity) to talk with a SQLite database: http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite. It goes from setup to inserting data, so once you've completed that it should be straightforward to modify your webpage viewing code to grab the data you need and shove it into the DB.
Good luck!

Categories