A Mendix widget to enable PhoneGap application to stay awake (prevent sleep).
InsomniaForPhoneGap is a widget which enables your Mendix mobile hybrid application (Android and iOS) to prevent the device from sleeping.
InsomniaForPhoneGap is an based from several other projects. Credit to the following:
- Mendix for their work on GeolocationForPhoneGap. The widget used in this module is based on their widget implementation, since I did not use the boilerplate to create the widget.
- Eddy Verbruggen for his work on Insomnia-PhoneGap-Plugin. The widget used in this module uses his plugin.
- Mendix 7.12.0 or later
- A project with a hybrid app
- Download the widget to your project
- Place the widget to a data view with a Boolean attribute (required)
- (Optional) Specify your on change microflow and/or nanoflow
- On your phonegap config.xml file, add the following line:
<plugin name="cordova-plugin-insomnia" source="npm" spec="4.3.0" />
- Supports microflows and nanoflows
- Supports offline hybrid app
- Supports both iOS, Android, and Windows Phone
It was reported that on iOS the app would fall asleep after the Camera has been used, even if you previously called keepAwake. A similar issue on Android where the photo library was accessed during app usage.
So to make sure your app honors keepAwake, you have to re-run that method after these kinds of 'external UI' thingies give control back to your app.
More info here.
- You can raise an issue on GitHub, I might be able to answer it if I have the time. Asking on Mendix forum probably won't get you the answer since I don't spend much time there.
- For questions specific to the PhoneGap plugin, you may ask directly to the maintainer.