iPhone realtime messaging - iphone

I'm going to do a simple app similar to Apple WiTap example. The purpose of it is sending a small text message between two devices.
The user with the first device writes and push over 'Invia (send)' button. Once done, the message will appear on second device with an alert.
How could I implement the string sending-and-receiving part in my project?
The wip source is located here: http://bit.ly/fYAQsb
Thank you.

You can use PubNub to send and receive messages, completely bypassing APNS.
Quick start and tutorials can be found here: http://www.pubnub.com/docs/objective-c/iOS/ios-sdk.html

Related

How to setup notifications in flutter application?

I was wondering if Flutter has the ability to generate push notifications from within the app. If so is there a code example of this?
Description:
An event occurs on the flutter app such as a button being clicked or an if statement being triggered, I want a push notification sent to the user.
The app should also always be running in the background, is this possible? If so can you provide me a link with an example of this implementation.
Thanks in advance for all the help!
I have looked on google but I haven't been able to find a lot of information regarding these two topics.
Being an iOS engineer, I'd say that you actually want local notifications. Push notifications are usually being sent by a server.
You could check how it's usually done on iOS natively: developer.apple.com.

Messaging service within my app

I need to implement a message service into my app that works exactly like this:
users register with a nickname within the app
they can add contacts (just nicknames) and send them a message by just specifying their nickname
they can send a message whenever they want, and the message is stored on a server until when the receiver connects to internet.
when a message is received, a push notification is triggered.
So, the messages work pretty much like emails, however instead of using email addresses, we only use usernames. I'm also going to build my own back-end for it.
Which APIs should I use or which 3rd party framework can I use ?
And any tip ?
N.B. I need to make it work with iOS 3.0 as well.
and in the future I will develop an Android app, so the nicknames should be unique and I should be able to send messages from iPhone to Android devices within the same app.
thanks
I've successfully used the Three20 library and would recommend giving it a try. It's an open source spin-off originated by the author of the Facebook app. It features a bunch of additional GUI components that might be useful to your project, like a message composer that resembles the one used by Apple's email app.
Also, Three20 features a nice framework for handling navigation within your app. Currently, the biggest drawback seems to be that certain features don't play well with the iPad API.
The answer seems to be Push Notifications

iPhone background notifications

I'm making an iPhone app. I can receive UDP messages using AsyncUdpSocket. I want the app running in background, and when receive a message, an UIAlertView is displaying to the user, and he can enter in the app, or ignore the alert.
Is it possible to detect a message when the app is running in background.
Do I need something to execute my code in this method?
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
I saw lot of tutorials, with timer, but I don't need timer to wake up my app. Also I read that's it's possible while playing music, tracking position or using VOIP.
Do I need to play a fake song to keep my app running? or to do something like that?
This app is for security, for example if someone is touching or moving your motorbike/computer/whatever else, your iPhone can alert you and prevents from stealing.
I read other threads similar but didn't find an answer.
Thank you guys for giving me tips, or any help /sample.
You can't run in the background on a non-jailbroken phone without being in one of those three categories of app, and Apple’s really unlikely to approve your app if you use that facility for another purpose. UDP probably isn’t the best solution for this anyway—if your phone leaves the network that the other device (whatever it is) is on, it won’t receive the notification at all, whether or not it’s in the foreground. You’re probably a lot better off using the push notification API.
This seems like a perfect case to use Apple Push Notifications (APN). You app can register to receive the notifications and the phone will alert the user with any combination of badging, messages, or sounds. Sounds like you already have a server that is sending the UDP messages, so incorporating APN should be minimal. Especially if you use a third-party to send the push notification, such as Urban Airship. (I am not affiliated with them, but have used them on a large commercial project.)
By definition, local events are not triggered by receiving a message.

can we send messages to user even when the application is closed in iphone sdk?

i m making an application where data is accesed from website and displayed with an application.i have made an action which will tell the user that new data has arrived.this will work properly if the application is open .but if the application is closed than ,is there any way to tell the user that new data has arrived ,,so that he can open the application and check the data?
If you are using the Apple Push Notification Service (APNs), your messages will be delivered whether the application is running or not. For information on how to control what information is presented to the user, read the Apple Push Notification Programming Guide.
You should use Apple Push Notification Service, like codelark said.
I would recommend looking into Urban Airship for help getting started. It's a third party service, but it makes things much easier. Urban Airship does have their own tutorials and code samples which may be easier than Apple's.
As a follow up to the reference to apple push notification, as of ios4.0 I believe you, you may have a few more options, 1) you can send local notifications (just like push notifications, but they originate from inside your app) that could be timed to be delivered even if the app is not running..assuming you know approximately how long it will take for data to arrive. 2) if your data update will occur soon after the app closed.. your app can request a certain amount of time to complete an operation (even though the user has closed the app) and wait for the data, then send a local notification to tell the person to come back into the app. 3) if your functions based on gps updates, music streaming, or voip you can set a flag so your app continues to run in the background
sorry for the unstructuredness of the answer, this was just off the top of my head, hope it helps

Implementing sms push in iphone

Is it possible to invoke an application on reception of an sms. I have created a sample application and it need to be launched when the iphone recieves a particular message. Is it possible to implement this in iphone. If possible, which way shall i do that... pls help...
In short, no.
In the long answer, I believe with version 3.0 you can have your app subscribe to Apple's push notification service. Meaning that you can have your app answer to a notification from Apple that you send. Not quite SMS, but it accomplishes the same thing.
Try this:
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html