I want to make an android application.i.e.It's a quiz application.
Like after publishing my app I added some new question.
I want when user get connected to internet application should be updated.
So how can I update application from internet?
Do you have the data held in sqlite within the app? If so, you could look for updates to data on the internet (presumably on a website you already host) everytime the app starts. Do this in an async task so that it doesn't affect the user experience.
If newer data is found, you could fetch it and update the sqlite tables in the background.
Data bundled with app : If you compile and upload a new apk file to play store, update will show in users play store. This is good for occasional updates, like a new version of app or so.
Data not bundled with app : you can make your app fetch its question data from a remote server. This is easier for very frequent updates, like you add questions daily on a web site. But you will need a server.
Related
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)
I have developed an educational android application. I have also developed a web application to insert questions on the web and download in android sqlite database. And also the test result is uploaded to the web. The application is working locally without internet when its database is updated.
My Problem: I want to update my android application's sqlite database from my website using internet and to upload test result after someone completed the test. So, give me information programmatilly as soon as possible to update my android app from my website and to upload test result from android app to my website.
I will be highly thankful!
That is not a good practice to change your local sqlite database from web directly. You need to store your activities status in an external database (probably on your web server) and let your android app talk to your server and ask for update or new results (preferably a JSON response) and let you app update your local database.
If you want to get notified if anything has changed on your server you can use Google Cloud Messaging (GCM) or you can write a SyncAdapter to poll the server periodically to get the latest changes.
But never try to update your local sqlite database from web!
I'm new to Android and I'm thinking of uploading my app to the playstore but I haven't tried uploading a single app.
I already know the steps in uploading however there is something that I need to know first.
I want the app to update everyday that doesn't need to notify the user for update. Say for example, in a bible app there is a "Verse of the Day" which is updated daily without downloading an update, just stay connected to the internet and the verse will be updated. I have no idea on how to do that. Is it just uploading a newer apk daily? If so, do I have to notify the user? How do I do that?
Any help would be appreciated.
Method 1:
Basically, what you are planning to do that can be achieve using API.
If you update database on the server then the API will automatically update the new data in the user phone's when it starts.
You can also implement logic that when any new data is added you can fire a local notification from the app and the user will be notified!
Reference: http://code.tutsplus.com/tutorials/android-sdk-making-remote-api-calls--mobile-17568
Method 2
You can create service or background activity that keep on running and calling your API after some interval of time. Whenever new data is received it will fire local notification. (This is not an efficient way because it consumes memory and internet data both)
E.g.: Alarm Manager
Reference: http://www.vogella.com/tutorials/AndroidTaskScheduling/article.html
Method 3
You can implement "push notification service", so that you can push notification on the user's device without updating your APK.
Reference: http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
P.S. All these method can be done without releasing the new APK on the Google Play Store.
I don't really know what your problem is. You have to host your "Verse of the Day" somewhere online and in the app fetch this data from the server. Why do you want to upload a new version of your app for this?
For the latest content that you want your app users to have, can use the Couchbase Mobile feature called Live Query that abstracts out having the user explicitly ask the server for any updates.
When the app is connected to the internet again, content will be updated accordingly if the user's Android app does not have the latest content locally.
I developed an app which fetches a website data. Now the app will work only when the internet is available. But I want to add some content to the app for viewing in offline mode. So I want to know is it possible to fetch data from internet on installation time?
It's not possible. You can consider downloading your data on first launch.
Currently I am working on android e-commerce project, I am using sqlite database to store data.
I need to update my database each and every time. My question is if i upload my app in android market, how can i update my database every day.I know about android versioning concept if i update version of the my apk , how people who are using my app will know that my app is updated.
Please give me a clear idea on this . Thanks in advance.
I have a better solution for this problem. It will be better if you host a web service that will serve the update information. You can do it for free. GoogleAppEngine provides this feature. Serve JSON file from web, parse it in you application. Each time your app launches, write code to check for update information. OR check once in week or some other strategy. This might be tougher way of doing but you can provide more efficient and flexibility through this.
if i upload my app in android market, how can i update my database
every day
You can do this stuff using Web services call to your data server .
now you might have a question in your mind about users devices battery ,
if you continually call those web services your device battery gonna loose lot.
or
if you call this web service in some specific interval then app user might miss the actuate time when data has loaded already .
so i suggest to use GCM for could push notification .
How its works in your project :
When you data will update on server , then there should be one script on server side which send message to GCM server with some required field of identification of that application package
when you device receive that message using your GCM receiver you may need to update your database as you did so far .