Is it possible to interact with ios devices even though app killed? - ios

Is it possible to create an app where the message is automatically sent from one device to another when both the devices are in the same geo-location in predefined range or in the wireless points like Bluetooth?
I think there must be some way to do this. Please let me know if you have any idea about the same.

In peer-peer connection, It is not possible. When the user terminates the app everything goes with it.
But if you connect it with server, you could try to implement the behavior you are looking for with a push notification with content available, which gives you some time awake to download content in the background.

Related

How to get connected/disconnected information for the apps with Xamarin.Android and WearOs?

I am trying to implement communication between WearOs watch and Android phone Apps. Here is the key point is between Apps, not between Devices because for me important is that, i can get the information about if the watch app is connected with the Phone app and vice versa. But it seems that On Android and WearOs, it happens on device level.
I have implemented WearableListenerService on both side and works perfectly fine. OnCapabilityChanged is fired as well but problem with the OnCapabilityChanged method is only fired if connection is lost and connected again. It is not fired when phone and watch are already connected and when I start the app on the phone, I am not able to know if there is already connection.
OnPeerConnected seems to be a good candidate in this sense but it is deprecated and never fired.
What is the best way to get this information? I have tried also Activity level CapabilityClient.IOnCapabilityChangedListener on MainActivity but OnCapabilityChanged behavior seems to be exactly the same. It is not called when the activity is started.
I have tried to implement code below also in OnResume but it returns always null.
var capabilityInfo = capabilityClient
.GetCapability(capability_wear, CapabilityClient.FilterReachable);
capabilityInfo.AddOnSuccessListener(this);
public async void OnSuccess(Java.Lang.Object capabilityInfo)
{
}
Beside this question, related question, is it even possible to disconnect phone app to watch apps?
I have had similar experience on Tizen watches and There is a SocketService with Connect and Close endpoints implements. Simply can be connected between Apps. But here on WearOs, it seems to happen on Device level only.
What's your definition of "watch app is connected"?
The Node (device) is connected and the app is installed? Or do you mean the app is running.
If you just mean app installed and device connected, then your code should work. Are you using a custom capability that your app declares? That should prove it is your app installed and not just the device connected.
File a bug using a reproduction in the https://github.com/android/wear-os-samples/tree/main/DataLayer project. https://issuetracker.google.com/issues/new?component=1065087&template=1592236
https://developer.android.com/training/wearables/data/data-layer
The CapabilityClient provides information on which Nodes on the Wear OS network support which custom app capabilities.
If you mean connected as in both running simultaneously then you would probably use ChannelClient, MessageClient, or DataClient to send observable updates. But this should generally be careful how you do that as you shouldn't try to maintain a live connection, say using the ChannelClient, between your watch and mobile apps. It will waste battery on both sides and there are hopefully more efficient patterns to achieve whatever you are trying to do.

iOS wake up/interrupt the device with Swift

I hope this question is fit for SE, but if not please tell me where I could move it and I'll do so gladly. I'm currently building an iOS app and need to wake the device up/interrupt the current app when a "match booking request" is made, the behaviour I'm looking for is similar to what Skype uses when a call is inbound, the handset either wakes up or interrupts the current running app with the answer/end call interface.
I have never had experience with iOS, and the only solution I can think of is to poll the app and check for requests but I imagine this could be pretty intensive on power consumption, I was wondering if anyone could point me in the right direction as to what technique I could use to achieve this efficiently?
An app cannot run in the background the way you are expecting. Polling is not an option.
It looks like Skype is using Apple Push Notification Service to wake up the phone.

Obtaining Wifi connectivity notification while in background

Is it possible to get notifications about Wifi connectivity state while an iOS app is running in the background? It is looking like a no, but I am also curious if this could be checked during a background fetch routine.
You have limited options to get processor time while in background and as far as I know there is no direct option to be notified on the WiFi status. Here you can find the modes of background execution: apple docs
I have tried with VOIP support to keep a stream opened while the app was in background. Everything worked ok and I was getting connectivity errors when the connection was lost, also I was able to try to reconnect from time to time until the connection was back on.
The only problem is that Apple will not approve the app unless your app provides a VOIP functionality (although the first two versions of the app were approved and only on the third one it got rejected because of flagging VOIP but not actually providing it).
I hope this helps.

Opening an App (iPhone) via bluetooth low energy

Hello I do hope someone can help me with this question as i thought it would be easy at first!
I'm a studying EE student who is not that good with code but trying!
Let me tell you my goal at the end of this.....
I would like to be able to open an app on the iPhone and then execute a bit of code to send a message, all via Bluetooth.
I would like to be able to pair this small Bluetooth device to the iPhone only once and be able for it to be in sleep mode (500 nano amps :D awesome) and when I turn it on (via a small switch) it will open an app and send that message. (the app is already done, you just have to press a button on the app in order to send the message, that's why I would like to use a Bluetooth device so you don't have to have the app open at all times!)
Sorry for the long paragraph but I need help! I have the Bluegiga BLE113 dev kit and im overwhelmed with all the information they give you! But I don't see anywhere where I connect to the iPhone and do what I want to do.
Has anyone done this before, can you steer me in the right direction?
As long as the person downloading the app has previously opened the app and they've agreed to backgrounding capabilities, then yes you can send the message in the background (if already connected). However, you cannot force your app into the foreground on a non-jailbroken iOS device.
Check out the BLE Transfer App sample code to get you started.
I guess what you need is:
the periperal implements the peripheral role
the app implements the central role
the app is trying to connect to the peripheral continuously (connectPeripheral:options:)
the peripheral wakes up on trigger and the phone connection request completes
the peripheral signals to the central using a characteristic change notification
the app receives the notification and executes the business functionality of your desire
the peripheral goes to sleep again
the app receives the disconnect event and starts a connectPeripheral:options: immediately
the app should utilize the new restoration feature of Core Bluetooth (watch the WWDC 2013 session 703 video)
This is just an outline and you need to know lots of small things to get it right. I suggest you try to go ahead and implement piece by piece and if you get stuck, ask a new questions. As #tdevoy suggested, the BTLE Transfer App is a good starting point. The Heart Rate Monitor is also a good source of info (OSX API is the same as the iOS).

Launch my app from bluetooth iBeacon connection (Private API)

I am creating a private distribution app and I am wondering if it is possible, using any methods or private API's, to open my app when a bluetooth connection has been made.
What I have discovered so far is that with iOS 7 and the ability to use iBeacons you can enter into bluetooth proximity and you can have your app send a notification to allow the user to then open the app.
What I am hoping to do then is have the app running in the background and listen for an iBeacon connection and, if one has been made, actually launch the app without the users control instead of just sending a notification.
I realize this would never be allowed publically, however is there anything private I can look at to achieve this without jailbreaking? I know to launch some apps you can do [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; however I want my app to listen for an iBeacon and then open itself up.
Is there any way or work around to achieve this?
Moving app from background to foreground without user interaction is pain in the ass. Sorry, don't have a solution, just want to share some information:
I asked the same question here and posted a bounty on it and got no good response:
Show some UI from background in audio player or VOIP app on iOS
At some moment I found a solution with the help of another person. It was based on usage of GSEvent (sending clicks to UI). You can look following questions. However, as I know, in iOS 7 these API became protected by entitlement. So, this method is dead (most likely).
Using GraphicsServices.h/GSEvent as well as compiling CLI iPhone tools with Xcode
Use GSEvent to send touch event,but it's invalid.
Simulating System Wide Touch Events on iOS
iPhone, how to fire a button event in programmatically
Apps can use region monitoring to be notified when the user crosses geographic boundaries or when the user enters or exits the vicinity of a beacon. While a beacon is in range of the user’s device, apps can also monitor for the relative distance to the beacon.
In iOS, regions associated with your app are tracked at all times, including when your app is not running. If a region boundary is crossed while an app is not running, that app is relaunched into the background to handle the event. Similarly, if the app is suspended when the event occurs, it is woken up and given a short amount of time (around 10 seconds) to handle the event. When necessary, an app can request more background execution time.
For detailed info:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html#//apple_ref/doc/uid/TP40009497-CH9-SW1
There are two scenarios: you either want users to be able to do something with your device other then use your app, or you want them to always be locked into your app.
In the former case you should trust user. Just show the push, timer or location notification and let them decide to launch the app or not.
In the latter case just lock the device using guided access mode.

Resources