Best way to implement a Photosharing app - android

I'm doing a photosharing app with account authentication using phonegap.
We will be using jquery(client),CSS3(no-images and animation)/codeigniter(server) and we already structure our database from the server.
I can't decide how should I retrieve my data and what to do with it after I pull it from the server.
I should retrieve the data base from the login that is used it pulls out the friends/followers/people who comment to the pictures just like instagram did but it is more like a combination of facebook and instagram.
The data should be synchronized or auto update everytime there's a new comment from the photos,friend request,etc,.
Should I cache the data when I pull it from the server?What is the best way to CRUD cache data?

Generally, you can prefetch some amount of necessary data when the user log in, and you can have a background service to schedule batch transfers and batch update data. It should not automatically sync data everytime (unless you really need it), because internet connections will shorten the battery life rather quickly.
You can read this good document about this: http://developer.android.com/training/efficient-downloads/efficient-network-access.html#PrefetchData
The document is for Android, but I think it can be applied for other platforms.
Hope it help you something :)

Related

What is the best way to store app data and load it in app?

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.

Design applications with dynamic data

if the application receives its data from remote server then we should save our data in the local database and have our UI load data from the local database for better UX right? Our UI should not load data from servers directly it will result in bad UX. Now my question is I am developing an e-commerce application and it’s data is very dynamic it can change anytime. The product can go out of stock, it’s price and the discount amount can change etc. So how to keep up with it. If I refresh local database every time user opens application then what will be the benefit of the local database. If any of you had faced the similar situation or worked on any e-commerce applications then please me suggest me better ways. Any help would be appreciated. I do not know if this is a right platform to ask this questions.
There are some solutions. You can use push notifications using Parse, for instance, when your MySQL changes. Or you can use JobManager to enqueue custom synchronization tasks. I recommend you to see this video and check out the video project: https://github.com/yigit/dev-summit-architecture-demo
This reflects your problem very good and it is a very nice solution and, the most important, it is developed by a Google employee.
I hope it helps you!

Best way to upload /sync app/game data to server. (Android Studio)

i have created a android app with sqllite database/android studio.its like a game.i want to upload users high score details to somewhere so users can see who is the best in a app highscore table.
i already created game and sql datase.
i dont know any method to upload data.
am i want to create a server?
can i use google drive or onedrive or something?
if i can upload to data to onedrive or something,
and if i know a method to connect to it,
i can calculate other users data and make the highscore table.
thanks please help.
For this task you would need to create a server with a database holding info for all of the registered players, or if you only want to keep track of the HighScores, simply keep the top ten results. Then you would have to sync the SQLite on the device with the database on the server on every app start or exit. On start you would pull /GET/ data from the server to update your local DB, and on exit you would POST your local results to the server. Then you could chose how to implement the server whether to track all data or just check if some of the results are good enough to be in top10 and write only them.
This is a fairly trivial task.
I recommend you read about JSON in Android, HttpUrlConnection and get familiar with the basics of HTTP.
You could easily figure out the "server-side" of this task simply by rolling over few videos in the web. Hope I've helped.

Android ContentProvider to access a list of exercises?

I am working on an android fitness app and I want to get the hang of using ContentProviders. I was thinking about using the myfitnesspal api to get a list of exercises, but the api is private and my request has not been addressed yet. Then I considered scraping exercises from a website--but I am a little concerned about the reliability of this approach (if the site goes down, app won't keep working).
What is the best way to go about this? Is it "safe" to get information from a website (rather than an api) with a ContentProvider?
Correct me If I am wrong. You want user to acces your data even if there is not web API active. So my thought for it would be
Download all the data from web API and store it in database
create an node to check if data has been updated in the API if updated download new data in background and update the database else show same data from database
Benefits
User don't need to download data all the time they use app and their volume of internet would be saved
User don't need to see blank page if there's not any data
If im wrong, i would really like to know.. but the answer is simple: a ContentProvider allows only the connection to a database in your cellphone. You can't use a ContentProvider to get data from the internet. What you're trying to do is achievable with a WebService, which is an application running on a determined domain on the Internet and allows you to call some pre-defined methods linked to URLs of this same domain (but i imagine you know about that, right?).

Persisting ListView

I'm building a listview and getting it's data from Parse.com. At the moment, every time the app loads up it queries for new data from Parse.com, causing the whole listview to load.
I'd like a situation where the listview references a local datasource and only go to Parse.com if new data is available. Somewhat similar to what the instagram app does whereby when you load it up, the list view is already populated and would get updated if needed.
I have tried ParseQuery Cache policies but the behavior still stays the same. What would be the most efficient way of implementing this feature?
Thanks in advance.
Sync Adapters can help you with your your problem. It is generally used for account and cloud synchronization. But there is no limitation using it.
http://developer.android.com/training/sync-adapters/index.html
Synchronizing data between an Android device and web servers can make
your application significantly more useful and compelling for your
users. For example, transferring data to a web server makes a useful
backup, and transferring data from a server makes it available to the
user even when the device is offline. In some cases, users may find it
easier to enter and edit their data in a web interface and then have
that data available on their device, or they may want to collect data
over time and then upload it to a central storage area.
Although you can design your own system for doing data transfers in
your app, you should consider using Android's sync adapter framework.
This framework helps manage and automate data transfers, and
coordinates synchronization operations across different apps. When you
use this framework, you can take advantage of several features that
aren't available to data transfer schemes you design yourself
You can access sample project here: http://developer.android.com/shareables/training/BasicSyncAdapter.zip
Note: Sync adapters run asynchronously, so you should use them with the
expectation that they transfer data regularly and efficiently, but not
instantaneously. If you need to do real-time data transfer, you should
do it in an AsyncTask or an IntentService.

Categories

Resources