Direct communication between iPhone users - iphone

I'm new to iPhone programming. So far I've only written a couple of simple apps just to get the hang of it. In a short time I will have an assignment to write an app that will let iPhone users communicate directly using short messages, and probably they will add a requirement to be able to send files to each other attached to the messages. Of course this sounds a lot like a mail client. For several reasons the client does not want to use mail, if possible, and attaching files would leave SMS messaging out. I've been reading Apple's documentation on local, push and broadcast notifications. Would any of these be the way to go?
Thanks

User bonjour if you are one the same network: http://www.mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/. Otherwise it sounds like you want to use Push. I'd recommend checking out Urban Airship

Related

How to send images or sounds to another iPhone/Android

I was wondering how games like Draw Something are sending the images to another iPhone/Android?
I want to be able to send a recorded sound/UIImage to another phone, how are they sent and received?
I'm relatively new to communication using iPhone.
I've googled and searched stackoverflow, but couldn't find anything.. maybe I'm not searching for the right query..
Thanks in advance!
They are sent via TCP/IP to a central server, or more likely, a group of servers. Those servers are responsible for storing the data and generating push notifications so the target device knows that new data is available. The target device downloads it from the central server(s), not directly from the other device.
On iOS, you can use the NSURLConnection class to push data to a server or read it back. The server is something you are also responsible for, although there are some third-party ones that you could use, like Urban Airship, to help with push notifications.

iPhone - Triggering APNS

I am working on a iPhone application which uses APNS. I am clear about the procedures in implementing APNS, creating device token, blah blah blah... I have no idea how to trigger and initiate the APNS from the provider side by web service. Can anyone suggest me some blogs or links which guide me to gain knowledge how to deal with it. Thanks in advance.
If you don't want to spend time doing it on your own, you can try Urban Airship. If you want to do everything on your own instead, check out this tutorial. It also explains how to create the required certificates.
Otherwise you can try libraries such as apns-php. Just make sure it works with lots of messages (I haven't tested it) and meets your requirements (you may want support for multiple apps). Avoid EasyAPNS because it just doesn't work with more than 10 messages (it tries to open a connection for each message and will probably get your IP banned).
If you just want to get a better understanding of APNS and don't want to get aboard one of the 3rd party services, then try:
NWPusher
It allows you to send pushes right from your Mac. Great for testing your client application and for setting up the right certificates.
You might want to take a look at Urban Airship, they will make things a lot easier for you.
If you want to roll out your own server, here are some good starting points in terms of documentation/help
apns-php
easy apns
Another tutorial

Whats the point in UrbanAirship?

I'm looking into push notifications for an app I'm creating. I've heard lots about UrbanAirship but I can't seem to find a definitive reason why I should use it? As far as I understand it UA is a middle man? This page shows the free version doesn't have a push composer, so a developer will still need a server themselves to create the notification, if their own server is needed then I might as well go directly to APNS?
What is the point and advantage of UA? And if you use it how do you send notifications without your own server?
A working implementation of push notifications involves many things, such as:
Keeping track of Device IDs (web service for the device to contact, database to store the IDs)
Storing metadata associated with each Device ID (ie. so you can refer to a device by a username or a group of devices by a tag)
Keeping track of which devices have been deactivated (which happens if the user turns of notifications)
Clearing out bad Device IDs
Actually forming the raw request to send the message to Apple's servers
Some sort of service/program to know when you need to send the notifications
Urban Airship takes care of 1-5 for you, which greatly simplifies the whole process. Yes, you if were just sending a message to one device, you could probably find a C# or python or Objective-C library to connect to Apple and form the message but as soon as you need to keep track of a large number of devices, Urban Airship provides a service for free (if under 1 million pushes a month) to take a lot of work off your shoulders.
(And this is just for the basic push service for iPhone, as this is the only service I have used)
To answer your other question, you do still need some 'server' or program to know when to push (#6). I, for example, monitor twitter with a python program for keywords and send out notifications when I see those. My program is not concerned with the details of how to send notifications, the Urban Airship library I use takes care of the interaction with Urban Airship and Apple.
If you start your free trial at nextdns, you find urbanairship becomes one of the most common offenders that they block.

Using Remote Notifications In My Application

I am currently starting my way on developing iPhone applications, and I have recently encountered a problem which I could not find a proper answer to.
In my application, I want one iPhone to send a request and another, far iPhone respond to that request using an Alert View, almost like the way Game Center works when you invite someone to play with you.
Do I do that with Push Notifications? Some server? Or what?
Thanks ahead,
A Newbie Developer.
Not the simplest things to try and do when you are new - but have a look at GameKit.
There is a sample application called GKTap which shows how to hook up two iPhones.
Don't be fooled by the word Game. This framework makes it easy to set up communication between phones, even using Bluetooth.
It depends on what you mean by "far". If you mean in another room, but within Bluetooth range or on the same local network, then there is GameKit. If you mean on a different network, or a long distance away, then you are looking at needing to have a server that keeps track of the devices and the connections between the devices so you can use Push Notifications. If you are thinking of something like Words With Friends where it sends a message to another user to tell them it is their go, then you would need the server.

How to make a chat system on iPhone?

I'm doing research for making a chat based app for the iPhone (it's not really text chat in the regular sense, but the principles are the same).
Maximum 6 people can be logged into the same chat room at any one time, and the most basic question is how to efficiently check for new messages?
Would I need to simply poll the server periodically? Or is there a way I could trigger an event on the phone from the server whenever there is some new content to pay attention to?
If having to poll all the time, I worry about the resulting lag as each participant will have to wait longer for others before they can post their own responses to others. And, potentially it might also be too much to handle for the server to respond to lots of requests all the time. It would also waste bandwidth, which is not free for the user...
Unfortunately I will not be able to set up a socket server for this app, it has to be based around a regular LAMP configuration.
I think you can either go with push notifications, or XMPP (Jabber) server.
XMPP will allow your iphone app to receive data even when in the background using the new multitasking features (listening for a socket), and i'm pretty sure you should find ready to use servers for LAMP (or at least open source implementations).
Note that the iOS4 multitasking API doesn't support polling in the background, so your only other option should be push notifications. If you're new to push notifications, you can maybe use a service like Urban Airship that might make the process easier.
XMPP sounds good for you idea, i think this is the best technology for Chat. It alos works great in iOS apps.
Maybe this code sample will be helpful to start using XMPP in iOS app - look at this QuickBlox Chat code sample. It demonstrates how to integrate 1-1 Chat, Chat in room into your android application. Also there is guide how it works. I think there will be no problem to integrate it into your application. Otherwise - Comments system below allows to ask any question you want and get fast answer.
Also there is Demo video http://www.youtube.com/watch?feature=player_embedded&v=SncQaJBBW_0 how this Chat works.
In my opinion the best solution is socket, but you say that you can't implement the server side for this.
You could also implement it with push notifications. You can receive the push also when your app is running and send all the data you need inside the push. Usually chat messages are short...
If you don't want to mess with push notifications on the server then the only thing left, as long as I know, is the polling.