Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Is any way to communicate with Unity when it is sleeping or in background?

Discussion in 'Scripting' started by chachi_app, Apr 3, 2017.

  1. chachi_app

    chachi_app

    Joined:
    Feb 9, 2017
    Posts:
    12
    Hi guyz! Question: Is any way to communicate with Unity IN ANDROID when is sleeping in background? For example, is posible to call any function of Unity from an Android plugin inside when it is paused in background?
    Thank u!
     
  2. ErikMartins

    ErikMartins

    Joined:
    Oct 28, 2016
    Posts:
    49
    It is not possible friend
     
  3. chachi_app

    chachi_app

    Joined:
    Feb 9, 2017
    Posts:
    12
  4. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
  5. chachi_app

    chachi_app

    Joined:
    Feb 9, 2017
    Posts:
    12
    Thank u! I´ve have done that. I´ve made a service in Android studio to track the GPS location.

    The problem is that i want to send to my backend in Gamesparks the (X,Y) coordinates.
    I´ve tried to integrate Gamesparks Android Studio SDK in my plugin and that creates an extra activity and my app gets black (empty Activity).

    I know it is a little bit complicated.. .but its is any way to send an gameobject of my Unity project to the plugin and call the method that i want inside the service?

    Thank u so much.
     
  6. chachi_app

    chachi_app

    Joined:
    Feb 9, 2017
    Posts:
    12
    The goal is to send the GPS coordinates from the Android service to the gamesparks server in background. Thank u!
     
  7. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,078
    If you want to have connection to a C# script from within Java, you have the following options:
    - UnitySendMessage()
    - Implementing an AndroidJavaProxy (the way to implement an Java interface in C#, and have C# methods called as callbacks from Java)
     
unityunity