I am trying to push json data from a servlet deployed in Tomcat to my Android app.
I've already checked out the C2DM but I think it requires me to have a working internet connection because the data is pushed from Google servers.
I need the push to be available when connected to an offline network (Wi-Fi). Can this be done? Or maybe anybody can suggest me other options? Thank you very much :)
This blogpost will help.
Related
I want to build an Android application using XMPP protocol for sharing real-time data. For this, first of all, I have to setup XMPP Server and best server to use is Openfire. I tried to install this server on my Windows PC, but unable to setup correctly.
This is the download link https://www.igniterealtime.org/projects/openfire/ from where I have downloaded the Openfire.exe file. After Installation it opens a browser window with URL=http://localhost:9090/ but the page shows "This site can’t be reached localhost refused to connect. Search Google for localhost 9090 ERR_CONNECTION_REFUSED"
Can anyone help me to resolve this issue or suggest me the installation procedure? Also if you have any other suggestion to use another XMPP server kindly let me now. I want to transfer data in real-time from one Android device to another.
Thank you for reading my post and replying back.
Is it possible for a device to send message to other devices using Google cloud messaging without an app server at all?
I have a centralized database using Google Cloud Datastore. The app will get required registration ids from the centralized database and the database is updated by all the devices. So, getting registration ids is not a problem.
Can this be done using upstream messaging? I am not sure because i have searched a lot but never saw an example where app server is not used for this purpose.
This question is not duplicate of another question, because here i have central database to store registration ids which is mentioned as a problem in another question.
In the most basic sense no, not at this time. You cannot send an upstream message from one device to another without an app server. You can create an app server on your device application but that is not recommended. The current recommendation would be to use an app server to facilitate your device to device messages.
To answer is it possible? Yes it is.
Sometime back I have created a POC to send GCM message to self, so I know its very much possible. I configured my GCM to work with any ip in developer console i.e. 0.0.0.0.
just use HTTP post to send your message from android as you would have done from Server.
Like (most) everything else, there is an API for that.
Google hosts its GCM service on GCM Connection Servers. The official document requires you to create an App Server to issue the API requests to the Connection Servers.
Alternatively you could setup the Connection Server to accept requests from any IP around the world, and then issue the requests via your client app. The API is here and it's quite simple.
Seurity issues
Bundling your API key with your app, and setting the Connection Server to unrestricted connections is an obvious major security issue.
Why bother?
Why bother doing all of this? Instead I would use a free service like Parse.com, which takes care of the users database and offers up to 1000000 messages a month free.
Has anyone actually done this. I would like to see example android project.
I have downloaded a code for XMPP Android chat client from here.
I want to setup my own XMPP Openfire server with this code, I cant find any config file there, can anyone tell me how to setup my own XMPP server with this application, or maybe I am missing something?
Download openfire from this link and install it on server, you can also install in on your local machine as well , it require Java Run Time Environment to be already installed on your system. There are already lots of tutorials/guides available for openfire installation.
Once you have installed openfire then you can run it alongside any XMPP client. It could be Pidgin, Gajim, PSI or Android based Conversation, Yaxim clients.
I would suggest you to write your own client because if you are new to android you might not be able to grasp completely How XMPP works at client side. I hope it help a little
I have just read that Conversations will automatically look up the SRV records for your domain name which can point to any hostname port combination.
So my problem is solved now. Just read the README.MD.
Some advice comrades, am thinking of developing an android app that retrieves some updates from a website. In other words when content of the website is updated the app content is also updated. I have searched google and i can't get clear answers on how to do it. Anyone tell me what do i need to do to accomplish this task. I have read about json parsing and web services but everything is not clear since am new to network apps.
If your server is a standard http server, you'll need another server that can establish a connection with the android device.
You can implement it yourself (using TCP or UDP), or you can use the trusted Google GCM:
https://developer.android.com/google/gcm/index.html
I recommend using GCM, but in either way, you'll have to make your current server, to notify the other server when it needs to send a message to any device.
I have go through several posts in the internet but did not get a straight and clear answer for this.
I am doing one app on android which needs data to be sent/received from a database over internet. So how I can send/receive messages from my remote database on my android device?
Is there any messaging framework available currently in the android to do this type of task?
One method I thought of is to have PHP scripts at my web server and I will call those php scripts from my android httpClient. But its a bit tire some and error checking also a bit problem and retry mechanism also not there.
Please suggest a good way.
Google have a service for that.
Google Cloud Messaging for Android
Google Cloud Messaging may be suitable just for sending push notifications to android devices and things like that. And XMPP could be used to send messages from one android to another. So what you have taken, using a PHP script and calling it using a URLConnection or HTTPConnection is a better way to make transaction with a remote database