I have an idea for an application and am trying to first get hold of a plan to implement it. I am planning to implement a java service on Google App Engine and this would be pushing messages to subscribers, i have a concept of channels, exactly the same thing Parse has. Unfortunately Parse is not supported on GAE and it only has an Android client.
Does GCM have channel based push notifications? Like one device can be subscribed to multiple channels and I can push messages through a channel and all subscribers of that channel alone get notifications?
Or do I have another option?
GCM does not support channel based notifications.
If you use GCM directly, you'll have to implement this functionality yourself: your server will have to manage the mapping between channels and devices (Registration IDs), and push to all the devices subscribed to a channel when you wish to push to that channel.
Note 1: this is already done, APNS and GCM. Do you have any other features in mind that this two systems do not yet provide?
GAE does not support listening sockets, which prevents building any server-to-device persistent connection push system.
Note 2: there is Channels API, but it's web only as it's wrapped in an opaque javascript wrapper and it's protocol is obscured on purpose.
Alternative 1: use an existing external service like PubNub, Pusher, Amazon SNS, etc..
Alternative 2: instead of GAE use Compute Engine, which has no such limitations. However it does not (yet) have any most of the GAE goodies: it's service APIs (datastore, queues, etc..).
Note 3: your idea of persistent connections would only work while application on device is "alive", e.g. in the foreground (at least on iOS, on Android it's possible but would severely impact battery). For universal push-to-device you would need to combine your system with platform-provided async push system (e.g. APNS and GCM).
Related
I would like to implement a server-side push notification service for iOS.
When the application goes to the Background I need to send notifications to the client for different events and if it's necessary to wake app the application.
Currently in my system I have Apache tomcat Server and what I'm interested in to have a kind of tutorial of how that could be implemented. Is it possible to use for instance web-sockets, or what kind of alternatives such as TCP sockets from JAVA?
I have found some stand alone services such as AirNotifier, and EasyAPNs but I would prefer not make complex my configuration by including more programming languages.
Thanks
I want to make an instant messaging app for android. I have the option of using GCM, but I do not want to use it since there may be other platforms that may communicating (web, other mobile platforms etc) with the app.
So, instead of using GCM , I want to use the Smack API (an xmpp library written in java), which uses sockets.
Now, I have a few doubts about it:
How smack handles connection drops/reconnects etc. Is it as 'simple' as GCM? in case of an internet loss, will it automatically reconnect when its available
Is it battery efficient ? Since its listening from its own socket, I would like to know if there will be a massive battery drain or not (it should be listening for messages 24/7 from a background service, and not only while the user is in the app)
Aside of these concerns, I would like to know if there are other (better) ways to have instant messaging. I cannot do sockets from scratch, and would like multiple platforms (thats my I am not a fan of GCM)
How i can make my own push notification server for my android & ios application?
m not wanna to use GCM.
GCM and APN are the client side part of the infrastructure. You should still set up your own messaging server. That event-based server will then push messages to the clients via the proprietary infrastructure. I think applications should be respectful of their enironment, and using the push facilities of the platform is indeed a good thing for your users. Also, it should be even easier for you to implement, thanks to the standard setup and the working documentation.
Otherwise, just pick your favourite message queue middleware (Active, Zero, you name it) and integrate it directly with the native client for the supported platforms, without using GCM (or Apple push). But be warned that this will make your application less efficient, and you may face higher development costs to set up the background notification service.
Node.JS provide a module called SOCKET.IO. I use this in my android apps for live messaging. You can configure it on AWS, Digitalocean Or you can use Heroku.
Here is the good example of Socket.io with android http://nkzawa.tumblr.com/post/46850605422/connecting-to-a-socketio-server-from-android
Android chat app wit socketio
https://github.com/nkzawa/socket.io-android-chat
I want to develop a simple push notification system for various android devices.
After two days of documentation i've found very interesting to use MQTT protocol.
System needs:
- an MQTT client on Android: eclipse Paho seems to be a good solution
- any MQTT broker you like for the server part: my attention is on Mosquitto cause is Open-Source
I've read documentation and the configuration file and seemed clear. The only thing that I couldn't understand is if i can manage topics (where clients subscribe to). In particular if i can create topics and how to.
Thanks.
It's not clear whether you mean on the client side or the broker side...
Assuming you mean the broker side, you don't need to create topics, they are created automatically as needed. You can control what clients have access to what topics using the built in authentication and ACL code, or you could use an authentication and access plugin. Writing your own is quite easy, or you could use the excellent https://github.com/jpmens/mosquitto-auth-plug
On the client side, simply subscribing or publishing to a topic is sufficient to create it on the broker, assuming you have permissions for that topic. This may not be the case in all MQTT implementations.
As an example, try subscribing to the # topic on test.mosquitto.org or iot.eclipse.org. These show a huge range of available topics and there is no admin to support them in the background.
This basically means that the only administrative load you have is restricting access on the broker where required.
Using code stole from somewhere, I made a pretty simple "MQTTMessenger" app for Android. https://bitbucket.org/mjgasner/mqttmessenger
From what I remember, you'll need to go into src/com/gasner/mqttmessenger/MessengerService.java
and change the host ip to the ip of your MQTT server.
For the MQTT server, I used Mossquitto server.
You'll also have to make sure you port forward port 1883 to the server.
I used this to send stock numbers to my phone. It's been almost 2 years ago, otherwise I could tell you more.
The C2DM directory is unrelated. It is Google's push notification service that I was also playing with at the time.
In the other directories at Bitbucket https://bitbucket.org/mjgasner are the .NET service and winforms app I wrote to communicate with the MQTT server. The service would accept the message from the android app through the server and reply with the stock amount it pulled from google's api.
If you have any more questions, comment below.
I would like to manage a connection between 2 applications, they will run on diffrent phones.
The purpose doesn't really matters let's say that it would be some kind of a chat.
How can I create this connection between the applications? I know how to do it on pc java programs using the socket and the serverSocket classes but I guess it's diffrent in here since the phone might change his ip when he moves between networks.
So how would you do that? how would you create a connection between 2 applications/phones
Given the scenario you described in your comment, using Push Notification i.e Google Cloud Messaging (GCM) might be sufficient.
So, when program B wants update from program A, it will ask the server to push a notification (via GCM) to program A. Note that program A will not connect to the server every x time to check for updates.
Another out-of-the-box solution is to use SMS if the communication is not so frequent and messages are short. Here I mean SMS that will be processed directly by your app (given it has certain attention word) and will not go to the inbox i.e. no SMS notification on the phone
Since the two phones will, as you note, have changing IP addresses, you'll probably need to use an intermediary.
The general design pattern here would be to have a server with a fixed IP or DNS address that relays messages between your two mobile devices. The simplest implementation would be a webserver, to which each phone would connect via HTTP(S) to transmit data or poll for updates.
There are a number of backend-as-a-service platforms that provide this type of functionality pre-built, and would likely suffice for something like a chat system. Check out Cloudmine and Parse.
If you need a low-latency or near-realtime connection, you could also consider implementing your own server that uses the Android C2DM (Cloud to Device Messaging) service.
See Android's Sample Bluetooth Chat App, It will give you an idea for how it can be achieved.