Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
1
Question by Oana · Jul 24, 2014 at 08:38 AM · androidactivityhome button

How to keep other activities on top after pressing the home button on Android?

Let's say you're using some plugins that pop up other activities (as part of the same task), such as ad providers. You're watching an ad on this other activity, and you press the home button and then relaunch the Unity app. Now, because Unity runs in "SingleTask" mode, all other activities on top get destroyed, and the default unity player view gets destroyed.

The main problem is that a lot of ad providers don't handle this scenario, and end up in weird buggy states if that happens (including Everyplay/UnityAds). They usually become unable to display ads afterwards, and don't give the proper callbacks so it might freeze Unity.

How can I make it so that the second activity doesn't get destroyed when pressing the home button? Or how do you deal with this issue?

What I've tried:

  • exporting an Eclipse project and setting the app to SingleTop instead. This gives a black screen.

  • "singleTop" plus making the second instance of the unity activity get destroyed if it is not the root activity. This indeed shows the ad provider activity, but when I go back to the unity activity it restarts if it gets a new intent (aka if you open it once from the play store, and then from the dashboard)

  • "singleTop" plus bypassing the UnityPlayerNativeActivity(http://bit.ly/1A9QqNb) by creating a class that does the same thing if it is the root activity, and if it is not the root activity it returns without initialising or doing anything to UnityPlayer. This gives an internal segfault a short while after returning in the app.

Any other ideas? Thanks for reading.

Comment
Add comment · Show 1
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 liortal · Jul 28, 2014 at 07:58 PM 0
Share

The scenario you describe is not accurate - it will only happen in case you are in the second launched activity (ad), press the HO$$anonymous$$E button and then return to Unity from it's launcher icon (it is O$$anonymous$$ if you return to it from the recent apps list).

0 Replies

· Add your reply
  • Sort: 

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

23 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 avatar image

Related Questions

[Android] Keep music play on standby 0 Answers

Android -- accessing thread of the original Activity's views 1 Answer

How to tell if your android app has been put in the background? 1 Answer

How to get Native Activity of Unity in Android NDK? 2 Answers

Sharing photos and other files on android? 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