title: Android Unity App running in background
body: <p>I have a Unity app that runs on Android. It also continues to run when the app is placed into the background. It does not use a service to run in the background. Instead, this app creates a new thread, and this thread continues to run when the app is in the background.</p>
  
  <p>Recently, I have had to merge in some code from another app into this app. This other app has an activity that I merged into the first app.</p>
  
  <p>The activities from the different app have different names. In my Unity app that runs in the background, its activity is "com.unity3d.player.UnityPlayerNativeActivity"  The activity that I am merging in is "com.indotraq.android.rtls.MainActivity" which extends UnityPlayerActivity</p>
  
  <p>Through experimentation, it appears that if my activity is not a "com.unity3d.player.UnityPlayerNativeActivity", my thread that runs in the background no longer executes.</p>
  
  <p>So, does anybody have any ideas why my thread in the background will no longer execute and what I could do to get it executing again?</p>
  
  <p>The other option that I am aware of it to write a service that will allow my program to process information when it is in the background. The downside of this approach is that I would have to rewrite a bunch of code from C# to Java. And some of this code is not just a simple port. I guess I would have to rewrite some Unity low-level networking code to use sockets.</p>
  
  <p>So any advice on how to proceed? It would be great to get my thread running the background again so I don't have to rewrite a bunch of C# code to Java.</p>
  
  <p>Thanks in advance
  John Lawrie</p>