Updating an internal SQLite Database after the app has been published - android

I am very fairly novice to AndroidStudio and want to create a project of my own.
My question is:
Can you update a Database outside of republishing your app?
Say I have published the app and the Database is currently empty. Then later I want to add some data How would I add this data to the DB without having to change fundamental source code, or redevelop the app? I am using SQLite.
I would like to publish this application as a Network app. That is I want all users to view the same information from "empty" Database and whatever is populated. Could you guys give me a direction or a minimally functional example of Network apps / their requirements. I have never used or developed them before.
END_RESULT:
Users should download an app (this app) and be able to be able to collect news added to its feed.
The maintenance crew, should be able to add/populate the app via a database reasonably without having to redeploy the app every time new material is added.

You would have to implement some kind of server backend that your app communicates to in order to download new data. The app must already have logic for how to process that data and store it locally in SQLite, but that can be fairly straightforward. As for how to sync or download new data, there are several possibilities.
Perform a sync when the app starts. You may or may not want to do this if you are using some other (periodic) mechanism.
Schedule periodic syncs with JobScheduler. This is a good practice in that JobScheduler doesn't have to run your task at a specific time, it can run it within a certain time window so that your task coincides with other apps that need to run tasks. Since your task would spin up the radio and make network requests, the system can let other apps that need the radio also run at the same time to reduce the number of radio wakeups (and thus be more battery efficient).
Implement Google Cloud Messaging so that your backend can send a push notification to your app, and your app can receive this as a signal to perform a sync.
Note you aren't limited to only one of these.

Yes you can, if you add Realtime Database.
This is a database hosted on a server instead of directly on the phone, which can push informations to clients to synchronize new data on them.
Otherwise, you need to update the app to get new content.
One wonderful tool to achieve this is Firebase.
https://firebase.google.com/docs/database/

This is a very broad ended question and as such difficult to provide specific answer to. What do you mean by 'updating a database outside of republishing your app' ?
Do you mean update the database schema - YES, it can be done.
Put data into database - Yes, the app owning the database can do it anytime based on it's business logic.Which means the source code to insert the data should already be embedded into your published app. Only thing that should be decided on the fly, is when to execute this code.
Normally for a networked app, it's a norm to refresh the data when the app is launched. This means you can put a network call in your app's main screen launch and download whatever you wanted to download and put it into database. Your maintenance crew can put the data on a server and let the app download it.
Android has a plethora of network libraries and the choice depends on what kind of content you are downloading. Will suggest to try out Volley (Official from Google) and Retrofit (If you want something slicker)

Related

How to update mobile app UI(android and iOS) when web UI is changed

I had a requirement in our company by senior management.We are working on a business app that can create,initialise and submit a process.This is both for web and mobile.Below is the flow of the app.
User logins in to the app.
Creates a process(a process is a form) by using a drag and drop UI.
Created process is initialised and submitted for approval.
Above is the flow of the application.Now,the requirement for mobile is,once the process is created in web that has to be dynamically updated in the mobile app.
What will be the better approach for this kind of requirements.
**Note:**Please don't get confused with the term process.Creation of process is some thing like leave request process,HR processes etc which are just normal forms.
Technically speaking,need solution for a form customisation using a drag and drop that has to be updated in mobile dynamically when changes are made in web.
If I understand your question correctly, then what you want to do is keep a process in sync between the web and your app.
You have two choices. You can either make a call to your API every x seconds and check if there are any changes. The other way would be to use WebSockets which allow you to push data from the server to the client instantly. (So you when there is a change you can notify the app and update immediately).
Both ways have advantages and disadvantages, especially when scaling your app. If you want to have a "real-time" feeling in our app, I would recommend using WebSockets.
You need to have a progressive web app and try out the ionic cloud services
https://docs.ionic.io/services/deploy/
Live deployments let you publish web assets such as HTML, JS, and CSS directly to your users without going through the app store.
This lets you:
Update your application on demand.
Get new features and bug fixes to your users quickly.
But it has a price associated with it but!

Managing content of android app

For a simple app that has a list of (for example) stores, how are the CRUD operations implemented? Would a desktop/web manager app be the solution?
For example, the manager has all the CRUD implementations while the mobile app just displays and process search queries.
EDIT:
Lets say I am making an application for android that shows users where the best vegetables can be obtained within a 10 mile radius, such application would only have a list of stores, a search bar and perhaps a simple sistem for more narrow queries (like the organic etc...)
Naturally I'll want to add, edit and delete the record of stores that the app shows, but I don't want to even show a link or option to manage the app on the user interface for security reasons.
I was considering building a basic desktop app that manages the CRUD operations, whereas the mobile one just periodically updates the information to reflect changes if any.
This is my first mobile app so I am not quite sure how this is often deal with.
The answer for this question is very contextual. The answer is, it depends!
Is the data meant to exist only on the application itself? If so, I'd look into sqllite database management.
Is the data meant to be used on a web application aswell? If so I'd look into implementations such as parse (and many others) that will handle the persisting of the data.
Perhaps you have the data on the database already, maybe your next step is building a restful api to interact with said data

Syncing SQLite table over devices

Is it possible that I store my SQLite table over a dropbox account and have all my users sync their tables with the stored table? Also be able to make changes to that table?
Your approach could work in theory, but there are so many issues involved, that you're better off not doing it. If you wish to store and make data available across all devices belonging to a user, I strongly recommend looking into Datastore API by Dropbox. The API will take care of storing data locally as well as synchronize it over connected Dropbox accounts.
If you want a bit modular approach, you can use Windows Azure Mobile Services. These give you REST APIs to store your data in cloud. However, synchronization has to be handled by the developer - you. I have written a small library to do that here: http://bit.ly/ProjectMirror It's for Windows Phone, but Android version is already in a sister repo there. You could extend it. Let us know how that goes.
In addition to these services, Parse SDK is a good option. It requires you to pay after a while, though. In addition to what you want to do, it also provides other things like user management and so on. But, be aware that some of those operations may require you a live Internet connection.
So, in essence, if you want seamless data storage and sync, use Datastore. Be aware that you'll have no control over the server side. Also, your data will be restricted to the Dropbox ecosystem forever. If you plan on further expanding your app to other platforms, go with Azure and handle the sync. If you want lots of features, go with the Parse.
I would suggest looking into Google Play Game Services using the Cloud Save feature. Even if you are not building a game this feature lets you sync sqlite data in the cloud and Google will handle most of the work for you.
OR you could use a cloud based database which supports both push and pull. That means:
Scenario 1:
Your users change something on their phones. Changes are uploaded to the database. The database then pushes these changes to all other users.
Scenario 2:
Your users change something and upload this to the database. But instead of the cloud based server pushing the changes to all users, the users phones can ask the database for new data at intervals.
All this is very easy to set up. It took me about five, ten minutes. Just follow this easy tutorial:
https://parse.com/docs/android_guide
and for push:
https://parse.com/tutorials/android-push-notifications
We now use this for our company app, storing statistics for example.
Bear in mind that syncing can become complex. Try to keep it very simple, especially if you are new at programming.

android app for different end user

This may be as simple as for your knowledge. But I don't know how to search and get.
Now I've developed one android app with sqlite. Using this app, from my device only I can create and do insert and update the data as admin and user. I want to develop my app should be accessed by many user from different mobile and they should be update their detail. What are all the things I should know and How to do ?
Please help me out.
I am assuming you are new to this. Since your app is already completed and I am assuming it is working I would suggest reading up on the following things and you will need to make a few decisions also.
I believe that the LAMP stack would be best for you unless you have .NET experience, you should go read up on:
MySQL
pHp
RESTful web services and what they do here and here
How to AsyncTask works
How to run backgroud services
MySQL will be used to store your data in the cloud
pHp will be the server side language with which you access and query your database and control the data being written to it
RESTful will be the way you implement your pHp functions and how you will return data and process requests to your service
AsyncTask will allow you to run background processes in Android, it is important to remember never to run a long running action in the main UI thread, thus we use AsyncTask to accomplish the multithreading
I suggest background services since you already have a functioning app with a local sql database, the background services can then be used to keep your app synced with the database in the cloud, that way when a new user accesses your app on a different device that he/she normally uses his/her data will be available on the new device.

How to sync data between different devices

I am planing to implement an app and I have come to a point where I don't know what is the best approach.
Scenario:
I have an app where I am making a todo list and I am adding 3 items. I use my phone for this.
Then I take my tablet and want to continue adding another task. Then after a while I take my wife's phone and want to add 2 new tasks.
Basically I want to have a very simple way of storing the tasks online and be able to sync it with the app.
I am seeing two possible ways:
have a web server with a database + web service calls. This has the disadvantage of having a host paid, learn some extra mysql + web service techniques.
store somehow the data on cloud and allow the app by login to access an account which stores the file. I am thinking here at something like Google Drive / Dropbox. But I don't know how I would be able to sync only the updated values, not the whole file. Because I am thinking, if I store all the tasks into one file, each time I update the file, I'll need to upload it fully, which is not the best approach.
I am open to any advices. What approach would you recommend ?
There's also Google Drive's "Application Data" folder.
https://developers.google.com/drive/android/appfolder
This has the advantage of using the user's storage space.
I would look into either Google App Engine or Amazon Web Services. They both give you free allotment of usage per month and if you go over then you start paying, chances are you wont get past the free tier for a while.
AWS is a bit more mature than GAE currently and seemed to be a bit easier to implement that GAE was when I was researching them
Take a look at the new training class for sync adapters:
http://developer.android.com/training/sync-adapters/index.html for the basics of sending data from your device to a server.
On the Android device, I suggest you store your tasks in a content provider. This helps you keep track of updates since the last time you synced. You can then query the provider during your sync, send only the data that's been updated, and store the data on the server.
You should probably store the last update time on the device, so you can tell if the server contains data that isn't yet on the device. Remember that you'll have to download tasks as well if you want all devices to be in sync.
You can try Google's Firebase. Firebase provides SDK for Android and iOS devices. And also, firebase supports offline and syncing. Firebase also provides object storage service. It easier to create firebase app than you think. Have look at this firebase's firestore service.
You can take a look at our Rethync framework (freeware with source) . Using it you can simplify the task of detecting modifications and sync only updated data. Next, Rethync provides both client- and server-side API so you can create your own service (and host it on the web side) or you can write your own transport for the cloud service of your choice (we will provide some transports in future, they are under development now).

Categories

Resources