I know that once in the Firebase console, one can use the "Import" function and upload a .json file with the required data.
In my case, I have a web page, which contains only the .json data. I want to download this web page and upload the data to Firebase. The upload process could be from a stand-alone computer application or from a JavaScript web page.
The idea is to let the owner of the data import the files into Firebase without any contact with Firebase's console.
Is such thing achievable? If yes, I would appreciate any pointers given.
The Firebase CLI can be used to manipulate data for a Firebase project.
Install it with Node/NPM:
npm install -g firebase-tools
Sign in with your Google account:
firebase login
Select your Firebase project for the CLI to use:
firebase use --add
Finally, import your JSON files:
firebase database:set /dataDestination ./data.json
database:set will replace all data at the specified location (/dataDestination above). If you would rather push data to a list instead, use database:push.
You should be able to implement this programmatically through Bash or whatever scripting language you prefer that can access shell commands.
A more comprehensive guide and reference for the CLI can be found here:
https://firebase.google.com/docs/cli/
Related
We have Java Vert.x project. We have implemented the download button in our Web Service for our users. When user clicks on download button, we would convert the huge data in our database that the user asked for, to excel file, then upload it in AWS S3 and then the URL from the S3 would be sent in response to the user's download request. But this whole method takes time (Especially generating the excel file). Everything is don in backend. Please suggest better approaches than this to implement download option in the page(User has both option to download filtered or complete data that he is accessible to).
I am building A notes app with firebase. Where users can login and save notes. I want to add a feature where you can store multiple images and users can check it in different devices just with logging in. Like Google notes. I am pretty sure I should firebase Cloud storage for this but cannot figure out a way to do it. Can someone guide me please
Register your app with the Firebase, either from the in-built firebase assistant present in Android Studio or from the firebase website.
For uploading an image, first you have to add the dependency to your app level build.gradle
implementation 'com.google.firebase:firebase-storage:$latest-version
In the activity, add the following to get the reference of the Firebase storage:
FirebaseStorage.getInstance()
Store the reference in an object of type FirebaseStorage.
Later wards on can upload image using the reference variable.
You can read the docs
here
Edit
For uploading multiple images, one can use an Array of URI.
ArrayList<Uri> imageListURI
All,
I have a google application engine (java) that requires to store some images. I tried using Blobs and storing them in datastore but as you know there is a size limit on data that can be stored in datastore.
So as result I'm storing the images on a different server and store the path in my datastore and all works fine.
Now I'm thinking on using a google drive folder instead of using a server to upload the files to the drive and using the share link to display them later.
I've seen https://developers.google.com/drive/web/quickstart/java and got it to work fine. When I try to use it in my application however obviously this won't work as the code is assuming a credential for a local user.
I created a service key on my application and want to change the sample code above to use it but I'm not sure if that's the correct approach.
Tried searching for samples but can't find anyone that takes the same approach. Is there a working sample that shows how to authenticate an application not a user and let's say store a file in google drive?
I've also seen https://developers.google.com/drive/web/examples/ please note what I want is to store files in my google drive and not the user's google drive. So if user A and user B come to my app, they shouldn't have to authorize my application and should both be able to upload a file to my google drive.
I don't know if this can be done directly from their browser or I have to move the file to my application (appspot) and then push it to google drive.
Thanks
I'm developing a knowledge base java application, where I can store and retrieve annotations with its title, date when the note was created (SQL datetime), content, tags about the annotation, etc.
It can be done easily with a database (I'm using SQL Server 2014), but the main problem is that the server is running on my own PC and it has to be always on and running the SQL Server. Also, I would like to extend the application by storing and retrieving this kind of data on mobile apps for Android and iOS.
Is there any other way to store that type of data in some files so it can be uploaded to some cloud storage like Dropbox ? After storing it on Dropbox, all I would have to do is sync the app with dropbox, get the files and read/write stuff.
UPDATE: Thanks for all the answers they helped me a lot. The best solution for me is to replace SQL Server with SQlite, as Gabe Sechan commented. Now I can make changes on the database without the need of a server running 24/7 and I can use the same database on Android and iOS apps.
You can use just a basic ajax call to pull content from a Dropbox "public" URL.
function(contenturl,intoselector,callback){
if (contentwindow.currenttopic!==contentID){
jQuery.ajax({
type:'GET',
url:'//www.corsproxy.com/'+contenturl,
dataType:'text',
async:true,
success:function(data){
intoselector.html(data);
if (jQuery.type(callback)==="function")
callback();
}
});
}
Notice that this example pulls through corsproxy so that you don't receive any XSS errors, so the url you pass needs to not contain a protocol itself.
If you want to pull a JSON or XML string that is stored in the file, then you might need to play around with the dataType and contenttype options in the ajax call.
This can also be done using Google spreadsheets:
Reading:
Create a spreadsheet and publish it on the web
Use one of the many available Javascript libraries for pulling data from Google spreadsheets:
http://jlord.us/sheetsee.js/ (which uses Tabletop.js)
http://chriszarate.github.io/sheetrock/
Writing:
You can use a Google app script for writing to the spreadsheet (reference) OR
You can create a Google form linked to the spreadsheet and simply fill the form from your mobile app whenever you want to add some data to the sheet (reference)
Of all the cloud services, when it comes to Android, Dropbox's Sync API is one of the easiest to implement. Do you need specific code examples on how to sync with Dropbox?
I have an android application, which wants the user to login each time he runs the app. So, the login procedure is simple, using the sqlite dabase file i'm using. I've copied the file in assets folder and doing the necessary modifications. But, the database file is of no use unless it is on the server. I don't have any server so i'm thinkin of keeping the database file on dropbox, google drive etc and then read or update that file as per user commands. The question is how to do that? I was searching the web for it, and found that the only way is downloading the db file modifying it and the uploading it back. Can anyone give me an example??
Doing that isn't possible unless you have a server.
Because, if you are using dropbox, first you'll have to make your file public in order to download it (Not recommended at all. Compromises security). Then you can use the url to download the file. But you won't be able to upload it back (Unless you are able to login to dropbox through your Android code).
Instead if you a web server with MySQL n PHP, you can easily send POST requests to your server.