Reputation: 11
I have a problem, I need my Android app to stay active when it's in the background.
Application.runInBackground = true;
Upvotes: 1
Views: 7705
Reputation: 41
You can use UnityThread script, I've created Bluetooth low energy plugin that will continue to work within background in a new Thread.
Check this: https://github.com/222ZoDy222/Unity-Bluetooth-Low-Energy-Background-Andoid
Upvotes: 3
Reputation: 126
Android application created by Unity can't run in background. Application.runInBackground is ignored on Android and iOS platforms. In case of Android, Unity app extend Activity
class which run only when app in the focus. If you want run something in background you should extend and write logic in Service
class. It`s good described here. But for it need to write you own plugin or something similar to this.
Upvotes: 2
Reputation: 346
From this unity question:
Project Settings, Player, Resolution and Presentation, check the Run in Background option.
Upvotes: -1