Search code examples
javaandroidgoogle-project-tango

connectListener() not working for Tango - Failed to find the service on the system


I'm rather new at developing for google's project Tango, and I've just made my first Android app that uses the Tango service to extract Pose data. I'm following the Developer Guide from google. My question is regarding the "Callback based" method in the guide on this page:

https://developers.google.com/tango/apis/java/java-motion-tracking

I've already used the "Polling based" method on that page, and managed to get it working. However, it seems that to be able to catch point cloud data from Tango, I need to use the callback method, which is not working for me. When the app runs the function connectListener(), it crashes and produces this output in the Android Studio monitor:

I/ServiceManager: Waiting for service com.google.atap.tangoservice.ITango...

I/ServiceManager: Waiting for service com.google.atap.tangoservice.ITango...

I/ServiceManager: Waiting for service com.google.atap.tangoservice.ITango...

I/ServiceManager: Waiting for service com.google.atap.tangoservice.ITango...

I/ServiceManager: Waiting for service com.google.atap.tangoservice.ITango...

E/tango_client_api: TangoErrorType ConnectCallbackFunctionAndInitialize(const FunctionType*, const char*, va_list, FunctionType**, std::mutex*, void**) [with FunctionType = void(void*, const TangoPoseData*); va_list = __va_list]: (in TangoErrorType TangoService_initializeLOCKED(const char*)) Failed to find the service on the system.

Does anyone know what's causing this?


Solution

  • Solved it finally. The problem was that i tried to connect the listener after I had created the Tango object and connected it to the Tango service, and instead you should connect the listener inside the Runnable you pass to the Tango constructor.