Sending Message iPhone to Any iPhone over Wi-fi ( Data) across world - iphone

I want to develop an application which sends a Message from iPhone to other iPhone over the internet, I want to receive the Message from other iPhone even if my iPhone is running in the background.
I have seen the WiTap application, but socket will get disconnect when application is closed or if there is screen lock.
So is that possible to develop the application so that I can receive the message even if my app running in the background forever?

From my little Knowledge, You can't do it through WiFi.
When a screen lock happened, device will automatically OFF the wifi connection for increasing battery life.Thats why socket connection getting disconnected.
In iOS, apps can’t do a lot in the background. Apps are only allowed to do limited set of activities so battery life is conserved.
But what if something interesting happens and you wish to let the user know about this, even if they’re not currently using your app.
For example, maybe the user received a new chat. Since the app isn’t currently running, it cannot check for these events.
Luckily, Apple has provided a solution to this. Instead of your app continuously checking for events or doing work in the background, you can write a server-side component to do this instead.
You can do it using Apple Push Notification Service.
It uses push technology through a constantly open IP connection to forward notifications from the servers of third party applications to the Apple devices; such notifications may include badges, sounds or custom text alerts. In iOS 5, Notification Center enhanced the user experience of push and local notifications.
More details are here
Note: details and screen shots are taken from raywenderlich website/blog.

Related

iOS 7 Bluetooth - app that handles events in background even after phone restart

I want to write a tracking application, which reacts/record when users get in a car and phone automatically pair with Bluetooth hands free. I need also Id of the hands free device.
On Android it is easy, using Broadcast Receiver your app listen to broadcasts that device had been paired with phone. It is working even after phone had been restarted and App did not run after restart.
Is it possible on iOS(7+) ?
You can do it by reading the "Performing Long-Term Actions in the Background" part of this docs
Essentially, using state restoration, the system takes note of what your app was doing when it was killed.
If the app is searching for a bluetooth device and is killed by the system, the system will take care of continuing this research and wake up the app again when the bt device has ben found.
Note that this will work only if the app is killed by the system, not by the user (using the multitask bar). This behavior has changed since iOS 7.
Alternatively, If your BT hardware can be programmed to send advertisements using the ibeacon protocol, your app can be "awakened" by the corelocation/ibeacon api. After that prompt then maybe the corebluetooth pairing code could be initiated.

iOS and Bluetooth low energy, possibilities?

I want to connect a robot, via Bluetooth, with an iPhone (4S or more) via Bluetooth low energy (BLE) 4.0. This robots require to send all the notifications of the iPhone to the device.
For example: If the iPhone gets a new email, I must send the event to the robot, and it will blink an LED. Stop.
I want to know if the iOS Bluetooth APIs of the Bluetooth framework can do this, or better, can share the Internet connection or whatever that can do this work.
I'm asking this, because I have heard that the APIs have some restrictions.
PS: ANY solution that can do this is very accepted (no Wi-Fi connection solution).
Bluetooth LE would be the way you want to go here, because standard Bluetooth requires your device to be MFi-compliant. Standard Wi-Fi could also work, if you're able to require the presence of the supporting network.
As of iOS 6.0, you can set up your iPhone as a Bluetooth LE peripheral, which would allow it to send notifications to your device, if it is configured in a central role. That would be a pretty power-efficient way of updating your device with new data.
However, there's one large hurdle to doing what you want here. iOS applications have no access to system-wide notifications, so you won't be able to listen for incoming emails or other notifications like that. You'll be able to send data to your device via Bluetooth LE, but you're not going to know when emails come in so that you could send that to your device.
With bluetooth 4, you could control a robot, as well as create a "notification" bot. It could be done quite easily. However as mentioned, you can't access system wide notifications in iOS.
However, you could use an external solution to listen for system notifications and then an API to listen a singular encoded notification and have your app listen to that.
One such system is https://ifttt.com (no affiliation)
There are also some great plug and play BLE options for rapid prototyping.
You can do it. A simple solution would be let a phone check your email periodically. Don't rely or try to use external Apple applications to do that, but use services provided by your mail.
In the case of Gmail, try to go to https://mail.google.com/mail/feed/atom. If you are logged in your Gmail, you will see the unread mail in XML format. The way you would login using a URL is: https://username:password#mail.google.com/mail/feed/atom
So what you can do is periodically parse the output and when <fullcount>0</fullcount> value changes call your robot service via BLE which should act as a callback for this specific event.

Can an iPhone app send a command (data) through Wi-Fi (or maybe Bluetooth) to a device at a specific time when it is not running through?

Situation: My iPhone communicates to an external device through Wi-Fi. The app has also the ability to set up a schedule. This means that on a specific time the device should turn on and do some stuff. Now for this to happen there should be a timer on the external device or the iPhone should send a command to the device on a specific time.
Question: Is it possible to send a command to the external device while the app is in the background? Or does the app have to be in the foreground? Is it possible when the external device is an accesory? Cause I have read that apps are allowed to run in the background when they need to communicate to accessories??
Thanks in advance!
No you can't do this, you are only able to run an app in the background if its stream audio, a VOIP client or track user location. If you are in the accessories program (which means you can make hardware that works with the dock connector, then your app can also run in the background. but only if the accessories that is respons to is connected.
There is no way the schedule any operation to be triggered at a set time.
You can schedule a local notification, but the user wil have to view (open you app by click in the notification) before you app get informed about it.
Do you actually have the devices communicating? If not, you should take a look at Apple's MFI (Made for iPhone) program. Sending data or communicating from your iPhone to an external accessory through bluetooth falls under it. They provide you with certain protocol specifications that allow you to communicate with external accessories. It's difficult to do something like this if you are an individual developer though. Here's the link: https://developer.apple.com/programs/mfi/.

Anyone using XMPP to implement Push Notifications on iOS?

I'm looking for any reference projects or key learning from anyone who has implemented XMPP/Jabber to successfully send notifications to iOS devices (iPhone/iPad).
I'm considering using an XMPP server (OpenFire specifically) to provide a single cross platform mobile push system. C2DM for android has a number of annoying requirements like users having Google accounts. This is what got me started looking at XMPP. I also need to support pushing to iOS devices. I know all about APNS, however I'm wondering if I could use the XMPP server for both Android and iOS platforms (and possibly more like Black Berry).
The things I feel might come up are:
iOS killing any persistent connection to the XMPP server. Will it
auto reconnect?
iOS preventing access to certain ports or protocols.
Anything to be aware of here?
Other gotchas one would only discover
by trying this?
Here you can find the answer to your first question:
when your app goes in background you (the client) close the connection
with the xmpp server. When your app comes back into foreground you
reopen the connection. If your server need to send messages to your
client, it must use push notifications. When the client receives the
notification can (it depends on the user action) go back to
foreground.
(source: iOS Backgrounding & XMPPFramework)

GameKit keeping connection going while device screen off or in background

I am working on an appliction that requires bluetooth connectivity, which i use GameKit for data transfer, however im seeing that when i go in background mode, or I just turn off the screen in app, the bluetooth connection is dropped... Ive seen other apps that keep the connection alive in such situations, anyone have any idea if I am missing something that wont cause the connection to drop on such cases? Have been looking around but havent found anything useful...
Thanks
Daniel
This is not intentionally supported by Apple.
If you are writing this for an application that doesn't have to be distributed through the App Store, you can set the application up to play a silent audio file in the background. This will allow GameKit to continue to work even when your application has been put into the background or if the screen has locked.
If this application has to be distributed through the App Store, Apple require the audio to be a real feature, with audible music playing.
If you have two devices connected using GKSession and then one of them is interrupted by call or goes into background, when it wakes up connection should be still alive (you should be able to send/receive packets between devices).
You may try setting
UIRequiresPersistentWiFi
in your plist.