android app for different end user - android

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.

Related

Share the same database between a Rails web app and a native app

I need to create a Rails app which in the future will need to share the same database with a native app.
As I am still quite inexperienced I would like to understand which way is the best to have the 2 app share the same database, in this case I will use postgresql.
I'm thinking of using postgrest for it but I'm unsure if there are any better/ faster ways.
which way is the best to have the 2 app share the same database
The best way is to not share database at all. Mobile app does NOT talk to database directly. Instead, it should talk to an api server, which will provide needed data and perform appropriate checks (user credentials, etc.)
The API server may be implemented as part of the same rails app or a separate app.
Another way might be to expose a read replica for your database to the mobile which can access the data directly through it via the API calls.
There are lots of options, depending on what you are trying to achieve with the web app. You can look into BAAS's such as Firebase or similar products. However, if you are already using rails, you try the new Rails 5 API mode, where all your controllers and models are preformatted to serve JSON making it slightly easier to get your API up and running for your native app.
An API (to clarify your understanding based on your comments), is a layer that will deal with creating, updating, editing, and deleting things in your database. You will have to define it using your own code (or rails generators if your app is very simple). This layer is so you can insert business logic before the database operation is performed based on the request sent from your app.

Updating an internal SQLite Database after the app has been published

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)

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).

websockets and sync adapter in android

I'm designing an application for getting some data from a web service, like a REST API and showing it to the user:
I was thinking about using the Sync Adapter with Content Provider API:
the Sync Adapter handles the data flow between the local DB and remote DB.
the content provider API loads the data into the UI.
My question is that the remote application, if, has a server push support (using Socket.IO or so), how should I design the app to exploit this feature? because as far as I understand, when the SyncAdapter will run is determined by SyncManager. So I can't ensure that the sync is done only when the server pushes. I wanted to know if this is possible, even without running the application in the foreground or background. i.e., only with the sync adapter running.
thanks in advance for any replies.
PS: I'm just starting to design android apps, so forgive me/correct me if I'm wrong.
Follow up:
I'm not interested in the Cloud messaging APIs (like GCM). I wanted to keep the data private if the user wishes to.
If your application will be running for a while you don't really want to keep a constant connection open to a server since that will eat a lot of batteries.
It sounds like you're looking for this:
http://developer.android.com/google/gcm/index.html
Using gcm your app can get a notification when there's an update on your server.

Android data collecting form

Basically my android project is around making a form to be filled up by the user of the app. And send this data to the php server. The data may be collected offline so the app should also save the datas unless its in the reach of wifi or gprs network. I'm early beginner to android and got stuck in between. Can any one suggest me a similar project sample so tat I could make a study and learn the stuff.
Sounds to me like a good use case for a hybrid client-server app. Use the mobile device to collect forms and store their results in a SQLite database. Whenever an appropriate wireless network is available, connect up with the server-based app and upload all the data. There are many good ways to do this, but for starters, consider making the server app implement a RESTful API and have the mobile device use this API to send in the data. If messing around with a server sounds like fun, I've had good luck with MySQL + CakePHP. One of the cool aspects of CakePHP is it gives you RESTful access to your database almost for free. Or, you can use something like Google App Engine and let someone else worry about administering the server.

Categories

Resources