3

for my current project I try to figure out the differences between Android and iOS. I only have knowledge in Android and absolutely no idea about iOS. What I want to know is:

I am very thankful for answers and also further literature regarding these quesiton!

Community
  • 1
  • 1
Mr. Jones
  • 385
  • 3
  • 8

2 Answers2

1

You can use an implementation of Reachability to get the notifications about Wifi connectivity, but keep in mind these won't wake up your app.

You can use Core Bluetooth to look for connectivity events. Again these won't wake up your app. I believe you can setup a delegate to a CBCentralManager to find out about that. Check out the docs here.

However, you are correct in saying that you still need to solve the issue of background execution to keep your app awake. For that you need features that actually make background execution useful to a user or Apple won't approve your app. Here are some of your options.

If your app has actual bluetooth features you can use one of those modes (bluetooth-central and bluetooth-peripheral).

If you have a feature that warrants background audio you can use this

If you have a feature that warrants background location you can use CLLocationManager startUpdatingLocation (but this would eat up some serious battery)

You might also be able to set up a system that spams silent remote notifications and then use the remote-notification background mode. This is meant for downloading content

Also keep in mind that a user can basically disable all of these things on you at any time.

Good luck!

Mike Gottlieb
  • 966
  • 6
  • 11
0

Im not sure if this will answer your question directly but it may be helpful. I know in Android that you can you an Intent to switch Activities. Well in iOS in order to switch to another UIViewController (iOS equivalent of activity) you would perform a segue. In prepareForSegue method you can handle what you want to do in the next UIViewController, such as passing variables etc.

You can use Background Fetch in iOS7 you can perform services while the app is asleep/in the background. This wakes the app at regular intervals in the background to perform a task, like refreshing data etc. You may be able to record the accelerometer values here. http://www.appcoda.com/ios7-background-fetch-programming/ has a good tutorial on this.

I hope this is somewhat helpful.

DevC
  • 6,982
  • 9
  • 45
  • 80
  • Hey DevC, thanks for your answert. Unfortunately it does not really help me. I am not looking for ways to switch to another app using intents, but for system intents which indicate changes of connectivity types like given in: http://stackoverflow.com/questions/4031740/where-is-the-all-android-broadcast-intent-list. – Mr. Jones Aug 22 '14 at 18:06
  • Also the mentioned background fetch seems not not correct to acquire sensor information but "fetch" web resources. As far as I understand from apples developer page, this is not allowed in iOS. – Mr. Jones Aug 22 '14 at 18:13