Skip to content

abhijeetdani/iOSLowPowerMode

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

iOSLowPowerMode

Unity Plugin for iOS to detect if device is in Low Power Mode

This plugin helps to recieve notification callback when user turns on/off the low power mode option on iOS devices.

Steps for successful integration:

  1. The signature for the callback function in your C# code should match "void lowPowerModeOn(string input)".
  2. The name of the gameobject on which the script with the callback function is attached should match "Game Manager".
  3. If you wish to change the name of the gameobject and the callback function, make sure it matches the first two parameters of the
    function call "UnitySendMessage("Game Manager", "lowPowerModeOn", cString);" inside the file "LowPowerModeDetector.mm" in
    Assets/Plugins/iOS/ folder.

Steps to test:

  1. You will have to build the project on an iOS device.
  2. Once the app runs, you will see a text that displays the current state of low power mode.
  3. Go to Settings->Battery and toggle the low power mode option.
  4. Come back to the app and you will see the text change to display the current toggled state.

Demonstration of this plugin can be found at https://youtu.be/mxzhWltq96M

FYI: The current callback function resides in "GameManager.cs" script attached to the "Game Manager" gameobject in the scene. If you want to use this project out-of-box then just add your custom code inside this callback.

About

Unity Plugin for iOS to detect if device is in Low Power Mode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published