Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
11 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 /
avatar image
1
Question by Khariton · Aug 12, 2015 at 10:17 AM · backgroundgpsruninbackground

Can Unity do this? (Background GPS triggers)

Hello, Haven't tried Unity yet and the answers on the matter that I found on the forums are non-definitive in my opinion.

I just spent a month using another cross app development framework to discover it has no way to let an app in background keep monitoring gps positions and behave accordingly: the gps tracking and listening to events ends as soon as it is put in background. (yes, my fault, I should have checked it first). Basically, it is a simple touring app, I don't want the user to always keep the smartphone in their hand but rather enjoy the surroundings, then when they get to sensible hotspots, I make the device vibrate or play an audio file, or a notification ... the crux is, phone is in their pocket, possibly locked, and the listening for gps location or other triggers needs to be made in background.

So, now wiser and before I use up another month to see if it is possible or not by myself - is there a definitive answer on that? Some say that the app needs to be flagged as run in background BUT that that setting only works for web player and PC ... others say it is possible.

So, is it possible or not? the answer to this question would make me switch over to Unity over the previous framework, so it is vital for me to have a definitive answer, even better if there were a Proof of Concept app or code that I could try myself to see if it fits my bill ....

Many thanks!

Comment
Add comment · Show 2
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 elektronische · Nov 18, 2015 at 08:51 PM 0
Share

Hi $$anonymous$$hariton! You were able to fix this? I have the same question, it is possible or not? Thanks in advance for any info.

avatar image tanoshimi · Nov 18, 2015 at 09:20 PM 0
Share

No, you can't. Applications in the background are paused. This is a deliberate design decision at the OS level, since Android/iOS never really "close" apps - they are just suspended. If apps were allowed to continue in the background your phone would overheat very fast.

You can write a service that runs in the background (like the service that checks for emails, for example), but that service cannot have an interface.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by splitpete · Jul 24, 2017 at 07:08 PM

This project was done in Unity and used background location and audio. That said, native code was needed for both iOS and Android in order to make it work.

https://www.motive.io/case-studies/ubc-gps-tour-app/

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

Answer by olegekbondar · Apr 30, 2017 at 05:23 PM

check here: http://www.devhelp.me/unity-background-location-service-step-by-step/

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 Khariton · Jun 14, 2017 at 11:13 AM 0
Share

I don't seem to be able to make it work. I am only interested in the Android part. How do I remove any iOS dependencies as I don't have XCode, and am running all on windows?

avatar image
0

Answer by Khariton · Jul 25, 2017 at 05:20 PM

Thanks @splitpete , that's a very interesting use case. what was the part that needed native code ?

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 splitpete · Jul 25, 2017 at 05:44 PM 0
Share

The background location/audio part. I suppose it doesn't answer the original question but it is an example of a Unity app which calls native code to enable that functionality.

avatar image Khariton · Jul 26, 2017 at 08:41 AM 0
Share

Well, it kind of does ... I read it as "it's not possible to do background geofencing without native code". Thanks

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Speech Recognition in background doesn't work correctly! 2 Answers

Keep unity running when minimized on iOS and Android 2 Answers

Keep app running in background for GPS tracking on iOS and Android? 2 Answers

iOS game - Run GPS in background? 2 Answers

How can I have GPS enabled iOS app stay in the 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