Hi I need to develop a fully functional IM solution (like viber or whatsapp) for android. It will have the basic chat features plus many more. Can any one direct me on this. I don't want to re invent the wheel so my target is to use the existing thing as much as possible for the chat server etc (some thing like jabber). If one can direct me for this, or give me some good advice for this it will be a great help.
Edit -
I will extend the application future to allow other platform clients like Windows Mobile or iOS clients. In that sense what would be the best technology to implement the server? It must handle real time traffic well. Will I be able to wrap or extend some sort of a XAMPP server to get my work done?
This is what you need. http://developer.android.com/google/gcm/index.html
It has everything you need for developing applications like viber, gtalk, instant messaging sistems, global user notifications etc...and its pretty easy to implement.
A good solution if you don't want to reinvent the wheel is to create a Jabber / XMPP client on Android and all other platforms.
Server-side, you can use an OpenFire server for managing the roster and conversations with the Smack Library
Google Cloud Messaging as mentioned Janbo is the best way for sending push notifications to your mobile app.
What you could look into, is something like Firebase. They have an incredible api for such applications
firebase link to android docs
Plus it gives you a backend at the same time for free.
Related
without getting into too many details, I would like to build an app capable of messaging between small groups of people. Basically, I need an API that will allow me to a) create a group message, and b) will allow me to later add people to it based on their selections from the application itself. I am relatively new to server side coding and am looking for some suggestions, tutorials, suggested apis (google hangouts vs facebook vs any other services that would be of use), etc. I already have google plus integration with the client side and server side authentication, so it seems like if something is possible with hangouts that would be the easiest route, but again I am just looking for anything really at this point.
The way I was kind of (hoping) it would work is that some messaging service provides the group chat and gives me an ID to it, which I could then have the clients request to be added to a particular chat and then I pass them back the ID to the chat and it begins an intent that takes them to the app itself that is hosting the chat between my users. Let me know if this is possible please, along with any suggestions!
You might want to try researching the ejabberd messaging server. It is probably going to be a bit heavy for your needs as well as difficult to learn (it is in Erlang) but I've found it extremely steady as a back-end for building a messaging server.
I want to create an application like Viber or WhatsApp etc. My main challenge is connecting clients and server. Right now what i know that i have to use Websockets standard for connections. For web client i want to use standard Websockets and for Android and iOS i will use libraries for them based on Websockets. For example here you can see an example:
http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps
is this approach for this purpose is right? Whats other alternatives? For example Viber or Telegram how face this issue? Please help me to choose right approach before start.
I will have 3 clients: Web, Android, iOS
Yes, this is the right approach. You will need to use websockets if you want to maintain a persistent connection with the server, which is essential to a chat app. You can try out using 3rd party libraries which offer webSocket functionality like SocketRocket(https://github.com/square/SocketRocket)
As an alternative, you can also try using a 3rd party chat SDK like Pepper Talk (https://github.com/Espreccino/PepperTalkSDK-iOS) which offers complete chat functionality including web sockets, notifications, UI etc out of box.
Disclaimer: I am co-founder of Pepper Talk.
Most of the apps use XMPP protocol for instant messages.
Websockets are wrappers around standard TCP/IP sockets, so my opinion is to use them instead.
Your biggest problem is actually battery drain for mobile devices. One of the easy ways to save battery is to use Firebase Cloud Messaging (FCM). Read more about this here: https://developer.android.com/training/efficient-downloads/regular_updates.html
I am working on an home automation system my android application can turn lights on and off using bluetooth, i want to add another feature of controlling the devices from webpage.
Can anyone tell me what is the easiest way to do this, i know GCM(Google Cloud Messaging) is the best solution but is there any other better or easy way of doing it.
And if anyone has some working piece of code, please share it with me; I want to finish this project as soon as possible
If you have a backend built using PHP, Rails etc you can have API's that the app can call and check for instructions. However, this has the side effect of draining he battery due to continous polling.
If you don't wanna go the "polling the server periodically" way, you can use GCM as you mentioned.
You can send data using the JSON data format. This is easily the lighest and most versatile data format used by many web and android apps and has tremendous support from third party libraries as well.
Here are some tutorials for this:
http://developer.android.com/guide/google/gcm/demo.html
http://android.amolgupta.in/2012/07/google-cloud-messaging-gcm-tutorial.html
http://www.londatiga.net/featured-articles/how-to-send-message-to-google-cloud-messaging-gcm-server-using-json-and-php/
http://fundroiding.wordpress.com/2012/06/29/google-cloud-messaging-for-android-gcm-simple-tutorial/
http://androidjayavelu.blogspot.in/2012/07/google-cloud-messaging-gcm-tutorial_27.html
What is the easiest way to implement a simple app which does two things:
receive push notifications (new messages in user's inbox),
open a page on my website in a webview or web browser.
It would be best if the solution was portable among iOS, Android and possibly other mobile systems like Windows Phone and BlackBerry 10, but I'm happy with separate solutions, if it's the only way to do it.
I suggest that, checking out Parse apis for this task.
There are solutions like http://xtify.com/ or http://urbanairship.com/products/push-notifications/ that provide an all in one package across platforms but I don't know the quality of service or which one would be right for you, some research on your part will be necessary if you choose this path.
Or you could implement it yourself but it will require your own server. The server would notify both Androids C2DM And Apple Push Service at the same time. You will have to implement the client side on each.
For iPhone here's a good tutorial for setting it up http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
For Android http://www.vogella.com/articles/AndroidCloudToDeviceMessaging/article.html
You register your app with both services then sends the push keys to your server. With the keys the server can then notify both platforms respective push services to send a notification .
I can't really help with the server setup stuff as its not my area of expertise but this is how we implement push notifications for the apps my company makes.
I'd recommend a Phonegap (Cordova) app and UrbanAirship for the notifications. You can get a free account with that. It's relatively easy to implement too.
As for the browser, I'm not sure exactly what you want it for. Could you elaborate and I'll post a response.
I have developed a simple two player chess game in android to be played using Bluetooth. I want to extend it by making it possible to be played through internet. whenever a player makes a move, the move should be transferred to the other player via internet.
How to make this possible?
I have heard of C2DM mechanism.Does that suites the scenario i described and is it reliable?
Thanks:)
Yes, C2DM is ideally suited to this type of game. This is what I am using for my own game (http://www.chesspresso.net) which is a correspondence chess client for android.
Things to consider when using C2DM:
You don't send the info to the devices, you notify the devices that a move has been made. You don't use C2DM to transfer data, you use it to notify that something has changed.
Its available for 2.2+ Android, which is the majority of devices. But if you wanted to support older devices you'd have to consider an alternative. I am using polling for older devices.
You have to request for developer access, then once your app is ready you have to request production status. If you don't do this you'll hit the developer status quota very quickly once its released! They are very generous with production quota, but you have to explain what you're using it for and it also can take a few weeks to get accepted!
Your users will have to have a google account that is authorised, otherswise C2DM won't work. Most users will have an account associated with their device, but some don't so this means that you'll possibly want to validate for the presence of an account to notify the user.
Its reliable, but every now and again a device will have to wait for the message. Sometimes a few minutes. Usually its instant.
Hope that helps!
UPDATE:
C2DM has now been deprecated, and replaced by Google's GCM.
Also, I strongly suggest looking at other options as tying yourself down to a Google specific API means you won't be able to support external marketplaces. For alternatives, I am currently evaluating Amazon SNS and I will also be looking at Urban Airship. There are possibly other alternatives I have not considered evaluating yet.
UPDATE:
Evaluation update of non google based push notifications:
Amazon SNS is just not a project for this task and Urban Airship for the vast majority of apps is too expensive. Unfortunately all the other alternatives are all very expensive also, especially if your app (like mine) relies heavily on push.
A good way of doing that is using a simple direct TCP connection between the peers.
If you're new to socket programming on Java, try this:
All About Sockets
Another option is to use some sort of IM as a communication medium for app. For eg. Use Asmack to connect to XMPP Im like GTalk. Prompt user to create an account there, for your game.
And use it to send and receive commands via IM. This way you won't need to setup your mediating server.
This works if user knows who he is playing with. To collect the user data and let them search for available players, you still need to setup a server. IRC chat room may be an option to avoid this also.
GTalk was just an example. You can use any IM or IRC also.
C2DM it's not design to transfer informations, even if they are small like "horse in b4" or things like this. It's designed to inform the device of something, maybe a newer version of a document or more articles on a website.. Stuff like this.. It's not designed to communicate device to device. And also it may be not fast enough for a real time chess play.
You should look for a more traditional way of communicate via internet or to search for some libraries (I'm pretty sure that something exists..) that will help you.
IMHO, C2DM is exactly the kind of thing you would want for a chess game; to be notified when the oppo has made his turn (which may be minutes /hours / days later ?). I have discussed my game with a few google android devs and they've stated that C2DM is ideal for this. You'll need to go via a centralised server though (well, not essential but very advisable) as there may be issues with resync'ing game state etc. Worried about "hitting the limit" ? Well, for a start my c2dm acct is restricted to "just" 100,000 messages per day. I guess you're buying the drinks if you hit that !!
Chess is often played by email. You could do that.
Of course, any centralized/federated messaging system will work.
What might be better for your use is to add a jabber client to the application and have the program generate an account name that is used for automated messaging. You could host the jabber server or generate the accounts on a free provider.
Google App Engine if you know Python or Java.
Alternatively there are two web app API styles in wide use today: SOAP XML and RESTful web services.
If you know RoR I would recommend using JSON/REST, because you can just use Phusion Passenger with Apache to deploy your app. Free, extremely easy, and makes your server very reliable.
You could, and I only mention this because my friends do this all the time, use twitter as a server between the games.
I also found a lib called mages which looks quite promising.
Good luck.
I did this for my online 2D rpg: http://developingthedream.blogspot.com
Basically, use a middle-man server to co-ordinate data between all your clients.
You simply open a socket and communicate with the middle server and it takes care of passing on the information to any other connected clients.
I wouldn't recommend C2DM because of the message limit, and because the latency is still to big. Using your own server you can optimize it, plus you'll be the only one using the service so your data will be delivered faster.
I think that C2DM is not right way for playing chess because there is no warranty that messages will be delivered. You need more reliable way for data transfer