How to detect launch app via MFi device on iPhone - ios

Could someone tell me "How to detect launch app via MFi device on iPhone"?
Apple announced several major changes for a new Location Permission Flow on iOS 13.
(https://gimbal.com/ios-13-location-permissions/)
If want to get the GPS signal, the user need to select while in using or always.
And set up showsBackgroundLocationIndicator = YES, the app could get the GPS in the background.
It works well on the normal case(Launch with press the icon on the mobile screen).
But I figure out it could not receive the GPS if launch app via MFi device.
I also report it on the Apple bug report(https://feedbackassistant.apple.com/feedback/7537501)
I got a workaround but the first one is how to detect launch app via MFi device on iPhone.
By the way, I also check the argument of UIApplicationMain, but no use.
Please help or try to give some ideas about how to achieve this. Thanks!
Test Steps
1. First launch & user accept the location permission
2. Confirm the GPS could be used & check the setting page
3. Force close the app
4. Plug with the lighting and launch via MFi device

Answer my final solution.
I figure out if the app launch via the MFi device, the initial flow will enter applicationDidEnterBackground and not run to applicationDidBecomeActive. So, I just add a flag to record that and detect the EAAccessory status.
Share for who guys have a same problem. Hope this could be helped.

iOS 15 can use CLLocation's sourceInfo(CLLocationSourceInformation) to determine location information is from Xcode or MFI.

Related

How to fix App Store connect demo video error?

I’m trying to upload an speedometer app to apple App Store. But I get this error message from apple:
Does your app interact with hardware, and if so please provide a link to a demo video that demonstrates the current version of your app in use on a physical iOS device, which shows the initial pairing process and entire app workflow with the designated hardware.
I have sent them an video of the whole app but don’t accept it. Does anyone know how to fix this issue?
In the video, make sure you demonstrate the pairing of the "physical iOS device" and other hardware(BLE device?).
I think there is no other way to make your app approved.
With another phone take a video of your iPhone using the app physically.
For example: while walking record yourself holding the phone and the speedometer changing.
Also, tell Apple that your app does not interact with external hardware.

Make iOS application run at startup iPhone or iPad

I would like to do my app open when iPhone is turned on. I saw that have some people saying can be using voip key in Info.plist but I tried and can't to do that. Do someone have any idea to help me? Thanks
In short, iphone does not have any access to permission to edit about "onboot" or "onstartup."
Thus, without jailbreaking this would not be possible.
Check the links I provided on your comment.
This would not happen, your app will be active in background through pushkit only when your app dismissed before device goes off.
VOIP - The app provides Voice-over-IP services. Apps with this key are automatically launched after system boot so that the app can reestablish VoIP services. Apps with this key are also allowed to play background audio.
Even with "voip" present in "UIBackgroundModes" in "plist", iOS App does not auto start after device reboot in iOS10
https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW1

Is there a way to prompt a user to turn on/off WiFi in iOS from an Alert?

I have this problem where when I go out my iPhone 6s on iOS 9.3.4 tries to connect to every hotspot I pass. Then when it is trying to connect I can't get emails/texts/alerts etc. My solution has been to turn off WiFi. But then I get home again and forget to turn it back on and I wonder why my internet is so slow until I remember to turn WiFi back on. I got the idea for an app to build a geofence around my house and turn off WiFi when I leave that area. I know I can't do this automatically because of the iOS sandboxing restriction, but can I pop an alert when I cross the geofence boarder that asks if I want to turn WiFi on/off?
I haven't found anything current that allows me to do this. I have searched extensively and only found "Stumbler" but it appears to be from 2007. I only know C# and do all my app development in Xamarin so C# code would be best or if you know of any libraries/components/plugins.
Also, I just want this app for myself so no need to submit to app store.
Thanks,

Communicating with a Bluetooth Classic device in iOS when the app is in the background?

I'm working on iOS development for a bluetooth peripheral. We want the (already paired) device to connect when a button is pressed on it, and this will cause the app to execute some code. Is it possible for the app to detect that the device is connected, even while in the background?
Also, is it possible for the app to bring itself into the foreground when this is detected? Would I need to be a member of the MFi program to do either of these things?
You will be able to detect that the device is connected in the background using Bluetooth 2.0, however you must include the App communicates with an accessory string under Required Background Modes in the app's plist.
So yes, the first part of your question is doable. However when you say: "We want the (already paired) device to connect when a button is pressed on it", it is important to note that this functionality must be built into the device's firmware. The app can always be searching for it, but the device will not be able to communicate with the phone until it connects. Therefore, the button must wake up the device and signal that it now wants to connect.
For the third part of your question, you will not be able to bring the app into the foreground without the user opening the app.
Btw, CoreBluetooth is the Bluetooth Low Energy framework for iOS. It is completely different from Bluetooth 2.0.
as ttarules told you iphone can't connect automaticly to a paired device.
I don't know what kind of bluetooth receiver have you in your device but generally you can set up a method of "AUTOCALL" that automatically call a paired device (in this case an iPhone).
When you (your iPhone) come around the device it automatically establish a connection!
If you set all the parameters correctly in the bluetooth module you can make sure that the iPhone shows a message like this: "YourDevice would like access to YourApplication" when the connection is established.
this way helps the user to use your application and you can run the code you mentioned above when the app start.

Device Notification or value change, find it in other device

I'm developing some application which should notify my current device values into other devices within certain area. Let say i'm having app, the same app installed in other 3 devices. When i change something in my device, that should be notified in other device. Like, i'm selecting one button, that button selection should be on other 3 devices too.
Is it possible to do without web service and is there any specific frameworks there in iOS to do this task. Its kind of bluetooth searching devices within the area. It should be within the room, without any internet or wifi something.
Can anyone help me to find the solution.
Thanks,

Resources