I newbie to android programming and I have question which might sound silly.
I am writing app for a shopping store, which communicate with store's website
Every user must sign in to use the app.
In sign-in process, I save information like user name, address to send products and phone number in website's database.
I have 2 questions:
should I also save user information in local database(sqlite), so in case user would like to change stuff, I won't need to fetch it from web server?(or fetching it every time is better approach??)
The app, display list(picture+description) of products the user can buy(total 12 products).
the list can change every 2 weeks or month. should I save the images locally and have an AsyncTask to check if something changed and only then to download the delta, or should I download them every time.
Thanks in advance
Android provides support for user accounts so it's hard to say whether you can use that or whether you need to implement a custom solution without more details. Have a look here for some information on implementing authentication accounts
As for question 2, I would store the images locally as you say there are only 12. You could then have the server notify the mobile app (check out GCM) when there is an image update to pull from the server. You can also have a look at the Volley library which will assist you in retrieving and displaying images from a web server.
you can store any information in sqlite and use some cache(private/public) to store images for first time store images in cache and from second time onwards load images from that cache use volley library for server calls and image cache
http://developer.android.com/training/volley/index.html
for question two: no you don't need to save the pictures locally to keep your app using the minimum storage space.
Related
I am really confused about the process of retrieving and displaying images to your android app from firebase cloud storage. I looked around the web, but am unable to get a definitive answer to my questions.
With regards to my app, I simply want a place to store a bunch of images (around 2500) that I can display. I don't use authentication and I don't mind making these images public.
Do I have to request a download URL every time I want to retrieve an image from storage? I am worried because Firebase Storage allows you to download 1GB/day and only 50k/day download operations for free, which is not a lot of download operations for 2500 images.
Is there a way for me to access and display images without having to call reference.getDownloadUrl() ** every time I display an image?** Maybe some sort of workaround by making the images public and then storing the cloud storage URLs in a Room Database?
Any help is appreciated.
Do I have to request a download URL every time I want to retrieve an image from storage?
No, you can use the same URL repeatedly. Store that URL anywhere you like. But you will always pay the cost for egress every time the URL is accessed. There are no free downloads after the free allowance.
Is there a way for me to access and display images without having to call reference.getDownloadUrl() every time I display an image?
No, as I said above, you can reuse the same URL if you want. You can also configre the entire cloud storage bucket as public and simply build URLs to object as described in the links here. But again, downloads will be billed according to the normal Cloud Storage rates.
Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources.",
"status": "ACCESS_BUCKET"
This is just a information question. I'm new to Android app development and currently I'm working on my first app and and it is ready for the release. Now I'm concerned about how to handle heap of users and where to save all their details my app is a service booking app so it needs to save all the order details products details and lots other stuff.
Currently I'm using cloud firestore to load and save all the data of app. But I'm having some issues like without authentication it won't allow users to access some of my data and other. I wonder how large apps save their data and load them perfectly.
I wish someone will help me how can I save all my app data and load them perfectly in app. And suggest me for a best way to manage large user base. And other stuff.
First of all, firestore is good option if you don't have complex backend logic on the database. For simple CRUD operations on data firestore is a good choice but as you said you have a bulk of data then you must go for the Backend database and then connect your database with Rest API. So that all your complex queries will be done on the backend and you can simply consume your API in the app.
If you have lots of data from different users, maybe you should use a central server(DB), something like Postgres or MySQL should work fine.
At the same time, you can also do some sort of caching to accelerate the fetching process, like create a small database locally(you can use Room) to store some user specific data.
So the app is for a Parrot Rescue. It will contain profiles for each of the birds that we currently have for adoption. So a picture of the bird, and then basic info about the bird. It needs to be regularly updated as the birds are adopted out and new ones come in. What route should I go? My main concern is that I want it to be relatively easy to update so that some of the less technically inclined could use it, as I won't always be available to help them.
Instead of loading a new version of the application every time, you should implement a database on a parrot information server. Then the application (the client) will ask the server to receive parrot information.
Just implement a mySQL database and a PHP page that returns the information in JSON format. Then through the application you will make a request to the server using the volley library or okHTTP and enter the information into a list.
As there are also pictures, use the glide library to download the images.
Also remember to upload small images to the server.
This way the app is always up to date
The easiest way is to update the app on the play store with the newest db, and let auto-update update the app with the new db.
Next easiest is to have a nightly (or whatever frequency) service download a new db and replace the old one from your servers
If you want it to be as easy as possible to update for everyone I would recommend a little app that has two main activities. One for displaying the entries of the database (and maybe also giving the ability to delete the entry) and another with a template to fill with all information and the image.
Then like Raffaele D'Arco explained use a little server. You could also delay the updates to be in a 5 minute routine or the like so that you put as little stress as possible on the server.
There are multiple good ways to update the interface without updating the app constantly.
Use a database which the app will download after a fixed amount of time which will be located on the server.
Secondly, if you have a website you can convert the web pages to XML or JSON or something like that and can update the app UI as per the data downloaded from the website.
I would recommend the second option as it is quite easy than the first one...
I am developing an Android application to collect the store (Grocery) information.
The application have modules to create store, set it's attributes like address, lat lng, operating hours, manager details, building photos, etc.
Once the store is created user need to list down the assests of that store by clicking photos and providing it's details.
To store all this details, i have around 15 SQLite tables.
Now i want to implement feature of 'Synchronization', all this captured details need to send to server whenever connection is available otherwise detail should be stored locally and whenever connection is available it should move to server.
Also, please note that the number of tables may increase up to 40 as application grows.
I searched for the solutions/approaches for this on Google but in most of the article or example they have mentioned for small scale application having small data.
I have also implemented synchronization feature for small datatable (2 tables), where i checked for last updated timestamp on server and local and if it's different then we synchronize the data. I don't this i should use this approach for such large scale and large database.
I have one approach which doesn't depend on numbe of tables.
I am planning to have single table which store the following data
id
URL
request header
request body
Now let's say connection isn't available while sending request so it will be stored in table. Whenever connection is available it start reading the table and execute the request, on success it will remove the entry from table. With this approach we need only one table in SQLite.
The problem with this approach is when we want to retrieve data offline how we can do that? Do we need to have local database schema same as server?
Please guide.
Thanks
If you are syncing data with a server and you are removing local storage data ,which is incorrect as per my knowledge ,in this case your app does not work offline.So for that when you sync data to a server at that time maintain some flag which data is synced.And then next time just check flag status if it's synced then do not synced data otherwise do syncing.
I hope this solves your problem.
I am developing a Food Recommendation Engine. We have a lot of photos which has to be downloaded from the server during the usage of the Application.
Do we need to cache or store the images locally just to reduce the network activity ?
If the data from the server is not going to change then you should store them but if the data is changed then you can do two things
On the server keep a last updated data date and depending on that always fetch that date from server, check if the last updated data is not obsolete if yes then fetch again or there is no need
Second approach is Store as cache and fetch every time you start your app