Call UnitySendMessage from Android Service
I'm working on Unity for Android application and have native Android plugin which implements background service.
Problem is that if I call UnityPlayer.UnitySendMessage
from any part of my Service, it's not catching from Unity. I call this method after UnityPlayerActivity is created.
When I call UnityPlayer.UnitySendMessage
from foreground, all works fine.
How can I call UnitySendMessage
from Service? Thanks for response.
I've never done something like this myself, but it might be a threading issue. A background service runs on a different thread, so when invoking Unity code from it, it may not be able to execute. You can try to marshal your call to the main (scripting) thread.
Your answer
Follow this Question
Related Questions
New Unity In-App Purchase integration problem (Android) 1 Answer
Unity 5.4.0 Analytics integration - Build failing due to some non descriptive upgrade pop up? 0 Answers
RunInBackground Problem. My timer have to continue working when app is in background! 0 Answers
Unity Analytics: No data from android device Unity 2019.3.0f3 (64-bit) 0 Answers
Unity in-app purchasing service occurs crash on Android 0 Answers