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 Catlard · Apr 02, 2014 at 06:27 PM · androidjavathreadsleepresume

Android application not responding out of sleep mode.

My team and I are working on an alarm clock function on an Android device that, if necessary, tries to bring a device out of sleep mode, and sets off an alarm scene using a native Java plugin. But we're facing a problem -- it crashes about one in six times, due (we think) to a problem with the application taking too long to load on startup. The device tells us that the app is not responding after starting up. This means our code to start up the app is working. But it does this instead of starting the alarm, meaning that our alarm clock doesn't work.

In DDMS we get an error citing ANR (application not responding) as the issue, and then a WIN DEATH (window death) comes after, which means that our activity was killed by the system, correct? We have since learned that this results from an application trying to do too much in its main thread. However, we don't know:

1) How to avoid this problem in Unity, by causing the main thread to do less work. The first scene the alarm clock opens is empty. The entire app is about 80.6 mb.

2) Why this problem would occur when the alarm happens while the device is sleeping, but not at other times.

I've attached logs of what the device does when it's successful and when it fails. Help me, Obi Wans! You're my only hope! Our deadline is tomorrow. :(

Here's the FAIL log: http://pastebin.com/j3h0dVxw#

Here's the SUCCESS log: http://pastebin.com/HPfc5gWM

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
1
Best Answer

Answer by supernat · Apr 03, 2014 at 02:47 AM

You are correct that Android will kill your app if it is running too long on the UI thread, but I don't think that's your issue, unless it was further down in the log, but I stopped reading at line 109 where it reported a null reference exception. Make sure you are catching that. Otherwise, it looks like you're loading up some json/database type stuff that can be slow, so be sure to run all of that in either an Intent Service or Async Thread. Intent service is the easiest to work with. Also, alarm clock apps that require a game to shut off the alarm is patented, so just be careful. :)

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 Catlard · Apr 03, 2014 at 02:53 AM 0
Share

Haha, interesting. As far as patents, we work for a company, so, I presume they're already aware of that. Are you referring to this?

http://www.google.com/patents/US5189648

We will check out the null ref. Thanks for your invaluable wisdom!

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

21 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

Related Questions

My Unity Android app is preventing the lock screen from displaying properly 2 Answers

Accessing Data from a Android java class 1 Answer

How do I save a screenshot to the gallery on Android Kitkat 4.4.2 or above? 1 Answer

Issue installing apk using old Cert 1 Answer

Accessing variables from android java objects 1 Answer


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