Using Remote Notifications In My Application - iphone

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.

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.

Control iPad with other iOS device

I am working on an app for the iPad and would like to be able to include the option to use a separate iOS device to control it. I have seen examples of this with games (notably Chopper 2), but have no idea how it is done.
Can anyone point me in the direction of the iOS frameworks that back this feature? I have looked through the SDK but cannot find the relevant sections.
Thanks
Im sure they use Game Kit or you could use the lower level Bonjour discovery.
Read through the GameKit docs.
You can start there. I guess the controller is actually a separate feature of the app that just sends messages over the network, using sockets to send and receive the data.
Send over the network from the controller. Receive them on the ipad in a running thread or however the service you use handles it. process the received messages.
Agreed with #alJaree. I'm working on something similar, though I've found it much easier to implement through Unity. Prime31 has a number of sweet plugins that allow you to implement things like Bluetooth through gamekit in a single line of code. I'm on my ipad right now so I cant be sure of the exact URL, but I think it's just prime31.com, in their 'unity' section.

Direct communication between iPhone users

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

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.

iPhone gui message from perl/shell-script possible?

I want to write a perlscript on my iPhone that is able to give me a heads up at certain points so I'm wondering how I would go about doing that.
Is there a way to get a message through the gui from a script running in the background? I've been looking without much luck. I had a thought about inserting a fake sms into the sqlite db as a last resort but it seems somewhat unlikely that it would work.
It would be nice to be able to make a push notification style popup appear but that might too much to ask.
Any ideas?
For reasons of security and stability, Apple does not allow scripting languages on the iPhone. You can run them on a jailbroken phone but I'm given to understand it's a hassle.
From the Apple Push Notification Programming Guide:
Note: On a desktop system, a
background process is often the means
whereby users are informed of
downloadable data for an application
that currently isn’t running. But on a
device such as the iPhone, background
applications are, for performance and
security reasons, prohibited. Only one
application may be executing at a
time.
The iPhone is a secure and reliable phone first and a computer second. Computing is sacrificed to ensure a reliable phone.
I found a solution I liked so I decided to share it. I found an app for jailbroken iPhones called GriP - Growl for iPhone. Which changes the way push notifications and other messages are handled. It also makes it possible to send messages from the command line via something along the lines of:
/usr/bin/GriP -t "Title" -d "Description"
It has worked great so far.
Thank you for your help TechZen and molecules.
Do you want information from your phone itself or from an outside source? If you want information from an outside source, you could set up a Perl script on a computer to e-mail yourself notifications (see Sending Email with Perl Best Practice).