In the release of iOS 9, apple introduces several new features. Multitasking is one of them for iPad.
With the new multitasking,
- There are new features for iPad users i.e.
- Slide over
- Split view
- Picture in Picture.
- The slide over feature let the user to use a secondary application at side bar and quickly to interact with.
- The Split view feature let the user to use two applications side by side simultaneously on iPad Air 2.
- The picture in picture feature let the user to play video at small screen and can be float on the window.
It is very essential to keep in mind that when user uses multitasking, app should use system resources very efficiently.
The application should be responsive.
Developer has to use size classes for the application so in multitasking, application’s user interface looks proper.
There would be memory pressure on system when user using multitasking.
The app that has more memory pressure will quite first. So developer has to create energy efficient iOS app, below are some guidelines to create energy efficient app.
You application should require:
- Great battery life
- Awesome speed
- Responsiveness
- Cool device
To achieve this you should use below technologies,
Energy Essential:
- CPU uses more energy for every task. You should use CPU when you need it by scheduling, batching and prioritizing.
- iOS device saves lot of energy by sleep. When it wake up it uses more energy to boost device performance. It will cost on battery. So app should not perform any task when it is in background and you should not wake up device with every push notification.
- Your app should avoid updating user interface when it is not visible.
- Do not make location request when not needed. More accuracy in location will take more time and consume more battery, so avoid accuracy whenever possible.
- Similarly avoid using accelerometer, gyroscope, Bluetooth and magnetometer whenever not require.
Reduce and Prioritize work:
- Your app should work less in background state.
- Suspend your task when app goes to background.
- Stop your animation, operation and User interface updates when application goes to background. If your app uses background execution like downloading content then app should notify the end of process to the system.
- Your app should use QoS (Quality of service class) to prioritize work. QoS is used to give priority to task. It is available from iOS 8.
- You can decrease battery consumption by using energy efficient APIs instead of timer.
- Timer are set to fire after some interval, in that period CPU has to wait and battery consumption increases. In that case use GCD tools and get event notification without using timers.
- When there is low battery in iOS device, your app should reduce CPU and GPU usage, stop animation and other heavy task.
Minimize and defer network:
- Your app should not download same content.
- Use caching to download data.
- Check network signal condition, use SCNetworkReachability Api to check network host. If there are network problem, alert user to request data when signal available.
- Always use batch transaction for fetching data. If you are downloading video then download complete video at once rather than small downloading small portion.
- If there is an advertize in the app then download all ads at once then show over a period.
User Graphics, Animation and video Efficiently:
- When your app uses standard control and window, there is no need to update content.
- When your app draws or performs animation, it uses CPU and GPU. So do not use animation whenever not require.
- If you are using opacity, do not use it over content that changes frequently.
- Do not perform drawing on view when there view is not visible.
- Do not use different frame rate animation simultaneously. Suppose you performing animation on view A at rate of 60 frames and using frame rate 30 for View B. It causes more battery drain. Then use 60-frame rate for both view.
- It’s not recommended to add any content while playing full screen video.
Reduce location accuracy and Duration:
- Using location service, application will get updated location. But unnecessary location request will prevent device to sleep and also drain battery.
- Stop location service when there is no need of location.
- Stop orientation change notification when there is no need of notification.
- You should request fewer update for motion update like accelerometer, etc.
Optimize Notifications:
- If your app using timer based notification then you should use local notification.
Minimize Peripheral Interaction:
- While using core Bluetooth to interact with other device, scan device when it is needed.
- Minimize traffic between the watch and phone; transferring data from watch to phone requires Bluetooth power.
Monitor Energy Use:
- There is a feature in Xcode that shows the energy use of application. Debug your application and check which part is using more energy and minimize that.
- Measure energy use by Instrument. Use Energy Diagnostics to measure energy use by application.
- You can also check energy use of application in normal mode in iPhone.
- To achieve this go to Settings >Developer > Logging on your device.
- Then tap on logging button.
- Make energy switch button on.
- Below down tap on start recording button.
- Now to import this energy log data. Go to instrument open Energy Diagnostic.
- Choose File > Import Logged Data from device
For more detail go to this link