I am creating a app wherein user shares some information. This data i am storing it in database through servlets i.e. i am calling my own servlets which will take data through url and store it in database. So i want other users of that same app to get notify that some information is available and in turn they will get the information that other user has updated.
For this to work we can use polling or pusher. But polling will take lots of battery power.
I have tried C2DM but its not working for me. So i am thinking for some other mechanism by which i can implement other than C2DM.
Please suggest some way to work it. and e.g. if u have came across.
C2DM is deprecated, the new version is called Google Cloud Messaging (GCM) and is exactly what you need for your use case. There is even a GCM Demo Application which uses a Java servlet. The source code can be found here, you browse it directly or if you prefer GitHub you can use this repository.
The servlet code can be found in the file
samples/gcm-demo-server/src/com/google/android/gcm/demo/server/HomeServlet.java
If you follow the instructions in the Getting Started guide you will soon have a working application. I would suggest you not trying to copy paste it together, you have to get a clear understanding of how the GCM architecture is working.
Related
Just begin to learn Twilio API. My intention is to make call directly from Android phone to any landline number. I have read QuickStart guide, build sample Android application and found that to make a call one need to have his own REST server.
I didn't have any experience with any SIP alike apps, but my understanding was that there's SIP provider server through which I could place a call and that's it... (with any kind of authorisation and so on).
So the question: is any possibility to place call using Twilio without my own server? Or as option - could someone advise me 3d party provider of those server which can be used to place call through Twilio?
Twilio developer evangelist here.
Hey, even better then setting up your own server yourself, you can just head to our Github repo and use the click to deploy button. It requires you to have a Heroku account which you can obviously use for free.
From there, you have your own URL for the application, which you can add to your Android App. So no need to setup your own backend if you don't want to.
The repo takes you through all the steps for configuring your app, but by all means if you have any questions, please do not hesitate in getting back to me.
Hope this helps
I am to build an android app that needs a central cloud storage (along with some server coding). My app is somewhat in the footsteps of
https://play.google.com/store/apps/details?id=com.justyo
I mean i should be able to store a login and registration (possibly FB login in the future too). Then, i will also have to maintain and fetch users' 'friends' in the app along with a status (that can be changed any time by the friends).
I am not new with android dev. I also know ample amount of web development. However, i don't know the approach to this kind of an app that is to use some server side code and online db for android.
I have search a lot on the internet and have found a bunch of stuff, but i am just not getting the confidence as to which approach is what i need here.
Is there something pre-built and given by Google themselves?
Do i have to by a domain, deploy a hidden (UI-less) web service and access it through the android app?
is there a free option out there by google?
Is there a sample demonstration android app out there?
I don't need the code or anything. I am just confused; afraid of starting off in the wrong direction. Please answer so it is easy to understand.
Thank you in advance :)
There is the Google Cloud Platform, specifically App Engine. You can read the Docs here.
You dont't need to register a domain to use the platform. Yes, you will need to deploy a (not necessary UI-less) web service to the cloud, accessed from the Android client through endpoints. Additionally, the service is free up to certain limits.
Sample apps are available for deployment once you create a project from here.
I have an android application that is designed to receive push notifications via GCM. When I initially designed the application, I used a "deprecated" tutorial (merely because it was one of the most in-depth I found) and my dev phone was running API 2.4, so I was able to get the service up and running without much issue.
Now, my development device is running Android version 4.4.2, so my goal is to "upgrade" my application to handle GCM properly for all devices (for now, lets ignore the fact that I'll have to differentiate how to handle Push Notifications depending on API level).
I attempted to follow the Android Developer tutorial for creating a demo client app for Google Cloud messaging, which can be found here. https://developer.android.com/google/gcm/client.html
While I hate to sound like I want to ignore to smart coding practices, this official walk through was a little big in terms of scope (My application supports Phonegap, and while I think implementing native GCM is much easier than using the PushPlugin for Phonegap, I don't want to handle more than is absolutely necessary in my Java code)
As a last ditch effort, I simply downloaded the demo gcm code from the source they provided here: https://code.google.com/p/gcm/source/browse/samples/?r=1ca8e646c517310e2d46a6a6eda74106b8084fc5
I attempted to import the gcm-demo-client application, and although I know my SENDER_ID, I don't understand anything about the SERVER_URL. The documentation provided by Android Developers talks very generally about HTTP vs. CCS, and I'm struggling to grasp where this server fits into the grand scheme of all that is Google Cloud Messaging.
Assuming I download the gcm-demo-server project directory they included (which seems to be some kind of Java Project), how do I host it? My previous deprecated GCM simply used a basic android application in which I would submit a form containing the device Registration Id, and a message with a title and context. Unfortunately, I can't figure out how to import their demo-server into Eclipse (since Eclipse doesn't think it contains ANY project files), AND I cannot seem to understand how this server connects with my application in any capacity.
TL/DR Summary of questions:
1.) How can I go about "hosting" the gcm-demo-server from URL #2 above?
2.) If I can just copy the Registration Id from my client app to the clipboard, can I just use my "android server" application to send my messages?
3.) Maybe it's just me, but I don't see anything resembling a Receiver class in the gcm-demo-client project directory, only a GcmIntentService. How can there be an intent when the application can't even properly handle messages?!
Thank you for your patience and help!
(P.S. - I cannot provide any code- however since the code in question is merely the provided Android Developer GCM demo code, this hopefully won't be a big issue)
1) There are many companies that offer server hosting services. You should choose one.
2) If you copy the registration Id manually, and hard code it in an application that serves as a "server", you don't need to host a real server, though that would only work in development. In production, assuming you'll have multiple users who install you app, you'll need a real server that receives and stores the registration IDs of all of them.
3) The demo client project you are referring to is old, and relies on a deprecated library (gcm.jar) which contains a default implementation of the BroadcastReceiver, which receives the messages from GCM server and starts the intent service. If you refer to the current demo app, you'll find a BroadcastReceiver class.
The demo app might not work because it is a gradle project and you should preferably open it in Android Studio. That might be why it could not see it as an Android project at all.
I have recently started implementing GCM myself and it is not difficult at all. I am using AppEngine for holding the backend part of my app. In Android studio, there is a very quick and easy way to generate both the android client and the backend part including the cloud endpoints and even a web interface for sending the messages (you don't need to use it though).
I followed this tutorial https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints
Maybe this is not a fully satisfying answer for you, but I found the code very much readable and I understood how this stuff works.
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).
I want users to send textual feedback to myself(the developer) directly(without involving Google Play).
Hence, I can get the suggestions to improve my app directly to myself, instead of users writing negative reviews on Google Play.
I do not own a website nor have access to any server.
I do not want to use ACTION_SEND, as that opens an email app.
I'm an android beginner and this is my first app.
Maybe that data can be stored in a database(on cloud, common to all users) that I can access at any time I want?
After researching, I think GCM is supposed to be used, but I no idea how to go about it.
Please tell me the easiest way to implement this.
Thank You.
That is not what exactly what GCM is for. GCM is primarily for sending data from the cloud to the the devices.
You are correct in thinking that one option is to store the data in a database in the cloud. You could use http://pythonanywhere.com free account and build a web app that provides you endpoints which will save and retrieve data to a SQLite db pretty easily (if you have knowledge of python and server side web concepts).
Another perhaps simpler option is to use a pre-existing cloud database solution http://www.parse.com is a cloud backend that also has a free-to-use option that you can use to store arbitrary data. It is pretty easy to get up and running if you follow their many nice Android tutorials.
One last option I will present is to use a Google Spreadsheet with a Form associated to it. Once you create a form if you know the right url and parameters you can send a post request to insert arbitrary data into your spreadsheet. I've created a library that simplifies the process of uploading. GoogleFormUploader. If you need help getting your form set up you can watch the relevant portion of my video tutorial covering this topic