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
Related
I am about to publish my new android java app,
I upload image profile to firebase storage,
Its working,
Without any permissions requests,
I am afraid that my app may not be accepted in app store because of no asking for permission,
So the question is:
is upload image to firebase storage needs permission and how?
If you performed a normal integration of the Cloud Storage SDK for Firebase, then you don't need to do anything special. Your app will have all the required permissions by default.
After added os version M. You need ask Run time permission for access storage.
Okay, so I am building an app that will go on the play store, it has the facility to add data to the Firebase (it cannot read it).
Second app will remain with me, (it wont go on the play store) and it is used to read the data.
Now what I did was, lets say the first app has package name : com.example.write and the second has com.example.read.
So I went to Firebase, created a project, added an application using the package name com.example.write and setup my first app. Working perfectly, I could add data to the Firebase database, now to create the second app, I created the android studio project, using the package name com.example.read and as both the apps use the same Firebase database, I added the new app in the same project in firebase, with package name com.example.read but then what I noticed was the previous database was deleted and when I hit the database button on the navigation bar, it gives me an option to create a database, when I do so, the first app crashes (probably because the old database was deleted to it could not add the data properly). So what should i do to use the same database on both the apps?
Using spark (free) plan of firebase!
So what should i do to use the same database on both the apps ?
To solve this, open Firebase Console, select your project, then click on Add another app and select Add Firebase to your Android app.
Provide all the necessary details for the new package name, in your case com.example.read, then download the JSON file again and add it to both of your android apps that are connected to this project. That's it!
So far my application has an sqlite database into which the user can put some items which are stored.
Is it possible to use GoogleDrive as a location to store this data, so that other users of the application can download the current data or do insertions into it?
I read some documentation about GoogleApiClient and had a look at this https://developers.google.com/drive/android/examples/ but so far I could not figure out what my problem is exactly...
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/
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