is it possible to create an iphone-app, which can communicate with other iphones (with the app installed) even if the app is running in the background or the iphone is locked (=standby).
there is an app called "Bluetooth", which establishes a connection, but looses it as soon as the app is closed or the iphone in standby.
hope i am not too confusing in my explanations
Related
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.
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.
My online app runs on iPhone-3GS iOS 4.3, use NSStream to communicate with server.
When I minimize the app, lock phone, and relaunch my app the streams will end.
So my app loses connection to server.
Anyone knows how to keep the connection after locking phone? Is it a feature of iOS multitask?
This is a feature of iOS. Networking connections of backgrounded apps are cut off. You need to request "VoIP" treatment: for this, you need to set the "voip" value for the Info.plist key UIBackgroundModes and then mark your socket as being a VoIP socket setting the kCFStreamNetworkServiceType of your socket to kCFStreamNetworkServiceTypeVoIP using CFReadStreamSetProperty.
See also the Apple iOS App Programming Guide, section Tips for Developing a VoIP App.
My iPhone application is based on remote desktop protocol which communcates with PC using socket programming. Everything works fine in iOS4, but now i encounter an issue with iOS5 based device.
My socket get's disconnected when user presses lock button in iOS5 based devices. I have developed a cocoa based static socket library which does all communication for my iphone app.
FYI: I just call a function exposed from my library to start the communication. I call it as a background thread using
[self performSelectorInBackGround:#selector(triggerCommunication:) withObject:IP_Address];
a. Why does the socket disconnects on pressing lock button in iOS5 ?
b. Is there a way to prevent the socket from not being disconnect?
Thanks,
If we compile with iOS5 SDK, and run application, then socket disconnects on clicking lock button.
I recompiled my application with iOS4 SDK and tested my application on iOS5 based iPhone. And now socket didnot disconnect even after locking!.
Thanks
Lets consider that I am connected to internet through 3G in my App. When a wi-fi hot spot seems to be appearing, can I programmatically switch to the wi-fi. Is this vice-versa condition possible?
iOS does this automatically by itself!
If no known WiFi network is found, it uses cellular data. If it finds a known WiFi-network, it connects to and uses that network instead.
If any WiFi-network is found, and your application requests access to the internet, iOS (usually) automatically presents an alertView and lets the user log in to a WiFi-network. If the user does not log into a WiFi-network, it stays on the 3G-network. When iOS 7 comes, iOS may connect to Hotspot 2.0 networks automatically as well.
Apple keeps individual apps on a tight leash, and so they do not let apps control things like this.