Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by mdeletrain · Jul 22, 2014 at 02:31 PM · androidbackground

How to force Unity to run in background on Android

Hi all !

I'm currently building an Android + Unity based solution for my customer and I'm facing some trouble since I updated from Unity 4.2.2 to Unity 4.5.2 (I also tried with Unity 4.3.4 and the problem is still here) :

I have Unity applications automatically started from a custom loader. This loader displays a customized dynamic loading screen above Unity while it loads.

This was working fine with applications build from Unity 4.2.2 but it seems all subsequent versions of Unity enter a somewhat paused state after waking up, waiting to be foremost before doing anything else. Obviously, since the scene is never loaded, the custom loading screen never disappear...

I overridden Unity's java activity to see what happens and indeed everything loads fine from here... except the main scene is not loaded until I manually kill the custom loading screen. Then Unity wake's up and everything works fine again. I tried to force the onFocusChanged callback to always pass true to its super class whatever it receives, but that does not work since the activity never goes into this method.

I tried to force the "Run in background" setting to true in player's settings but as expected it did not work, since it is only available in Web, OsX, Windows and BlackBerry devices.

Does anyone have any idea how I could force Unity to load the main scene and at least render its first frame ?

If that helps, everything is run from an Android 4.2.2 device.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by mdeletrain · Jul 29, 2014 at 09:17 AM

Answering myself :

The custom loading screen displayed above Unity had the TYPE_SYSTEM_ALERT flag set. Changing this to the more appropriate TYPE_SYSTEM_OVERLAY flag make the game load again using Unity 4.3+.

It seems that this should not have been working at the beginning. Unit 4.2.2- may have been to lazy about this.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do you make falling text? 4 Answers

How to run game on background in Android 0 Answers

Remote notification on Android, when the game is not run in background. -1 Answers

Can I make my Android game close if you leave the game on the title screen? 1 Answer

Resolution Independent Scrolling Background 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges