Mobile Background
The Mobile Background plugin is specifically designed to implement native mobile background features in both Android and iOS, for games built using Construct 3 and Construct 2.
The Mobile Background plugin features include excluding the application from the task list, for the application to go to the background or foreground, override the back button, unlock or wake up the application, configure background notifications, override notifications, etc.
Introduction
The Construct Master Collection supports the full and easy integration of native mobile Android SDKs and iOS SDKs for both Construct 3 and Construct 2.
Please click here to learn more about Mobile.
Features
The Mobile Background plugin is specifically designed to implement native mobile background features in both Android and iOS, for games built using Construct 3 and Construct 2.
Here are some of the native features of the mobile plugin:
Android application background features
iOS application background features
Native background features
Native background service features
Application go to foreground
Application go to background
Application wake up
Application unlock
Application exclude from recent tasks list.
Background notifications
Background service notifications
Background notification configuration
Battery optimization settings
Disable Webview optimizations to allow application to run in full performance in the background.
Well maintained and fully tested for production.
For more information about native mobile or Android and iOS features, please click here to learn the introductory lessons to Mobile.
Platform Integration
Here are some of the platforms that are natively supported:
Android
iOS
Native Android
Native iOS
Build Support
Here are some of the supported build options:
Construct 3 Build Service
Android Studio
Xcode
Phonegap
Editor Features
Here are some of the features in the Construct editor:
Construct 3
Construct 2
How to use?
It is easy to use the Mobile Background plugin, you will only need to follow the steps below.
1. The first step is to add the Mobile Background object into the project.
2. The Debug property is a toggle to enable logging of errors in the console, for mobile debugging.
3. The Auto-Start property is a toggle to automatically enable the background features.
4. The Run In Background is a toggle to run the Disable Webview Optimizations feature on startup. This will prevent the app from running less frequently in the background.
5. The Run In Full Power is a toggle to run the Disable Battery Optimizations feature on startup. This will prevent the app from sleeping in the background to conserve energy.
6. The Override Back Button is a toggle to run Override Back Button, on startup. This will override the back button to go to the background, instead of closing the app.
7. The Exclude Tasks List is a toggle to run Exclude Tasks List, on startup. This will exclude the app from the recent tasks list, this works on Android 5.0+.
Documentation
There is currently nothing to show, we will add more in the future.
Actions, Conditions & Expressions
Actions
The following action groups:
Core Features
Android Exclusive
Android Exclusive - Notifications
Android Quirks
Core Features
Enable - If Enabled, when the application moves to the background, the mode will activate.
Disable - If Disabled, the plugin will deactivate and the application will normally pause on background.
Check if active - Checks if the application is in the background, while background mode is active. [Now async because of worker mode.]
Android Exclusive
Go Background - If on Android, call to move the application to the background.
Request Foreground Permission - Starting Android 10.0, apps must request the Draw on Top permission, otherwise the action Go Foreground will silently fail.
Go Foreground - If on Android, call to move the application to the foreground.
Wake Up - If on Android, call to turn on the screen.
Unlock - If on Android, call to move the app to the foreground, even when the device is locked.
Check if screen is off - Checks if the application is in the background, while background mode is active. This works async compared to "Check if active".
Android Exclusive - Notifications
Override Defaults - If on Android, call to customize later shown notifications.
Title - The title of the notification. Leave empty for default.
Text - The text of the notification. Leave empty for default.
Sub Text - Click here for more information. Leave empty for default.
Icon - The icon of the notification. This will look for "xxxx.png" in platforms/android/res/drawable|mipmap. Leave empty for default.
Color - The color of the notification. In Hex format, for example "F14F4D". On Android 5.0+, the color option will set the background color of the notification circle. Leave empty for default.
Resume - If Enabled, the app will come to the foreground when tapping on the notification. Default is Enabled.
Hidden - On Android 5.0, if Enabled, the application notification will be hidden from the lockscreen.
Big Text - If Enabled, the text will be big in size.
Channel Name - Shown when the user views the app's notification settings.
Channel Description - Shown when the user views the channel's settings.
Allow Close - If Enabled, a close action will be shown with the notification.
Close Icon - The icon shown for the close action.
Close Title - The text for the close action.
Show Duration - If Enabled, it will show the duration since the notification was created. Default is Enabled.
Visibility - Android only, click here for more information. Default is Private.
Silent Defaults - If on Android, call to stop displaying notifications. Be aware that Android recommends adding a notification otherwise the OS may pause the app.
Reset Defaults - If on Android, call to reset the notification defaults to its original settings.
Configure - If on Android, call to customize the currently shown notifications.
Title - The title of the notification. Leave empty for default.
Text - The text of the notification. Leave empty for default.
Sub Text - Click here for more information. Leave empty for default.
Icon - The icon of the notification. This will look for "xxxx.png" in platforms/android/res/drawable|mipmap. Leave empty for default.
Color - The color of the notification. In Hex format, for example "F14F4D". On Android 5.0+, the color option will set the background color of the notification circle. Leave empty for default.
Resume - If Enabled, the app will come to the foreground when tapping on the notification. Default is Enabled.
Hidden - On Android 5.0, if Enabled, the application notification will be hidden from the lockscreen.
Big Text - If Enabled, the text will be big in size.
Channel Name - Shown when the user views the app's notification settings.
Channel Description - Shown when the user views the channel's settings.
Allow Close - If Enabled, a close action will be shown with the notification.
Close Icon - The icon shown for the close action.
Close Title - The text for the close action.
Show Duration - If Enabled, it will show the duration since the notification was created. Default is Enabled.
Visibility - Android only, click here for more information. Default is Private.
Android Quirks
Disable Webview Optimizations - The app may run less frequently or not at all while in the background, due to the Webview slowing down. Running this after On Activated or checking the property Run In Background, will prevent that.
Override Back Button - If on Android, call to override the back button to go to the background instead of closing the app.
Exclude Tasks List - If on Android, call to exclude the app from the recent tasks list, this works on Android 5.0+.
Disable Battery Optimizations - Starting Android 8.0, apps can be put to sleep to conserve battery, which will kill the background apps. This will ignore the optimizations and allow the app to run in the background.
Show Battery Settings - Starting Android 8.0, apps can be put to sleep to conserve battery, which will kill the background apps. Let the user manually choose whether to disable this or keep it enabled.
Check if ignoring battery optimizations - Checks if the battery optimizations are disabled for the application.
Conditions
The following condition groups:
Core Features
Android Exclusive
Android Quirks
Event Triggers
Core Features
Is Active - Checks if the application is in the background, while background mode is active. This works async compared to "Is Active". [Deprecated]
On check if active - Trigger fires when checking if the application is in the background, while background mode is active.
State - Checks if the application is in the background, while background mode is active.
Android Exclusive
Is Screen Off - Checks if the application is on the background while background mode is active. This works async compared to Is Active. [Deprecated]
On check if screen is off - Trigger fires when checking if the application is in the background, while background mode is active. This works async compared to "On check if active". [Both are now async because of worker mode.]
State - Checks if the application is in the background, while background mode is active.
Android Quirks
Is Ignoring Battery Optimizations - Checks if the battery optimizations are disabled for the application. [Deprecated]
On check if ignoring battery optimizations - Trigger fires when checking if battery optimizations are disabled for the application.
State - Checks if battery optimizations are disabled for the application.
Event Triggers
On Enabled - An Event Trigger condition that fires when the Mobile Background is Enabled.
On Disabled - An Event Trigger condition that fires when the Mobile Background is Disabled.
On Activated - An Event Trigger condition that fires when the Mobile Background is Activated, this is when the application goes into the background while also Enabled.
On Deactivated - An Event Trigger condition that fires when the Mobile Background is Deactivated, this is when the application goes into the foreground from the background.
On Failed - An Event Trigger condition that fires when the Mobile Background has encountered a Failure achieving background mode.
Expressions
The following expression groups:
Event Triggers
Event Triggers
EventResponse - Returns the response from event triggers. The conditions with green arrows are the event triggers.
Showcase
There is currently nothing to show, we will add more in the future.
Game Projects
Instructions Kit
Specifications
-
Instructions - The game project contains instructions and steps on how to use the addon and its features.
-
Action, Conditions and Expressions - It covers the implementation of each action, condition and expression.
-
Tips and Tricks - It provides some tips and tricks on the recommended ways of using the addon.