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
3
Question by Khalos · Oct 30, 2013 at 04:56 PM · androidunity-android

Android Lockscreen not shown when screen times out. (Wakelock?)

I am building an android app using Unity and it is coming along very well. However, I'm having an odd issue relating to the screen timing out and the lockscreen not showing.

What Should Happen

  • User stops playing

  • Screen Times out and turns off

  • Later, player returns and turns their phone back on

  • Lockscreen shows, user can enter their password, or otherwise unlock their phone

  • App regains focus and continues

What IS happening

  • User stops playing

  • Screen Times out and turns off

  • Later, player returns and turns their phone back on

  • Lockscreen does NOT show! The app is right in focus, bypassing the lockscreen all together

  • Users get mad that their security is compromised :(

Notes

  • This happens regardless of whether or not I'm using Android Plugins

  • I'm using Unity 4.2.0f4 (Though the changelogs for the more recent versions have nothing about this issue)

  • It even happens on a blank Android project

  • I've tested this on 5 different devices, all have the same problem

I suspect that this is caused by a wakelock that Unity does not give up when the screen times out. This causes the app to hold focus and the lockscreen never gets to 'load'. This is a pretty serious problem.

Does anyone know of any way to fix this?

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

3 Replies

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

Answer by Khalos · Nov 12, 2013 at 02:48 PM

I also asked this question on StackOverflow to see if I could get an answer there. After a few answers I was able to put together a workaround. This is my work around. It's not ideal, but I've submitted a bug report so hopefully this gets fixed soon.

Comment
Add comment · Show 2 · 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
avatar image eezSZI · May 22, 2014 at 04:07 PM 0
Share

Is this in the Issue Tracker? Any response from your bug report?

avatar image Khalos · Sep 18, 2014 at 09:43 PM 0
Share

It is in the issue tracker, it's still open and as far as I can see no one has responded. Here's the ticket.

avatar image
5

Answer by Meic · Sep 18, 2014 at 02:51 PM

I also faced this problem today. After short investigation found out that lockscreen isn't working as it's expected only in developnemt builds. When "Development Build" in "Build Settings" was off, everything worked just fine. Btw. I'm using Unity 4.5.2.

Comment
Add comment · Show 1 · 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
avatar image CasualT_Bossfight · May 08, 2017 at 08:04 PM 0
Share

Good thought.

I tested this myself and can confirm that on Unity 5.5.1 that the behavior is for a development build to come back immediately when locking and unlocking via the power button, but a non-development build requires the user to unlock by going through regular security: entering PIN, password, fingerprint, etc. So the app is certainly working as expected on a non-development build. The only thing is whether it's even worth having this special behavior on a development build at all, since it's causing confusion. If a dev wants a device to stay on all the time, there's an Android developer setting to do so when the device is plugged into a USB, such as when plugged into a PC to issue ADB commands.

avatar image
0

Answer by computerCondom · Jul 22, 2020 at 02:01 AM

This is still a problem in version 2019.3.0f6.

Like @Meic mentioned, unchecking "development build" fixes it.

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

19 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

Related Questions

Android Auto scale backgorund for any resolution 2 Answers

Is there is a way to play movie within unityplayer on android? 1 Answer

How should I begin developing for Android in Unity? 1 Answer

Sensitivity on Android Input.acceleration 2 Answers

Finish UnityPlayerActivity in android unity project 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