Closed jjcetraro closed 1 year ago
Destroying the activity is not enough.
I did not mean destroying the activity, but mavsdk_server
. But now I realize that MAVSDK-Java does not expose destroy()
:confused:. That should probably be added.
That should probably be added.
Aha!
Destroying the activity is not enough.
I did not mean destroying the activity, but
mavsdk_server
. But now I realize that MAVSDK-Java does not exposedestroy()
😕. That should probably be added.
Adding that method would be great! Can you do that @JonasVautherin ?
Yeah I'll try to do that this week :+1:
I have published mavsdk-server:1.2.1
to the Maven repository, it should be available in a few hours and expose the MavsdkServer.destroy()
function.
Please try it and let me know :+1:
Hi @JonasVautherin ! thanks for your support.
I tried to use this new version of the mavsdk-server, but it doesn't work. If I take sample app, and I change the gradle to use this new version of the mavsdk-server, it compiles but when you start it, it never shows the main activity. Did you test it with an android device?
Did you test it with an android device?
I did not, I just exposed the destroy()
function.
it compiles but when you start it, it never shows the main activity
My guess is that it blocks at the MavsdkServer.run()
function. Could you check that?
Hi @JonasVautherin !
You were right, the problem was I was executing the run method in the ui thread. Now is working! 😃
Thanks for your support, and also thanks to all the people that collaborated to solve this issue!
Yay, solved at last!
Great!
@jjcetraro would you mind updating the README on how to use the new method? I think you can use the MavsdkEventQueue to run the run() and destroy() methods.
I had designed the plugins in a way that the connections to the gRPC server happen on the MavsdkEventQueue. Otherwise, using the plugins would give a connection error and crash.
Running the run() method as the first function on the MavsdkEventQueue blocks these operations until it is safe to make these connections.
Hi @divyanshu1234 !
Sure, I will update the README, and also I will update the android sample to use this last version of the mavsdk-server (right now it is using the 0.7.0)
I was testing the android-client example, and the mavsdkServer.stop() call in the onPause of the MapsActivity works fine. I mean, I am testing with a sim_vehicle, and I can see on the console that when I connect to the vehicle I see "New connection on serial port 0" on the console, and when I leave the MapsActivity, I see "Closed connection on serial port 0".
This example is using:
I tried to update to the last version (1.1.1), and the connection to the sim_vehicle works fine, but with this last version what is not working is the stop method. When I leave tha activity, I don't see the "Closed connection on serial port 0" on the console, and I have to close the app to see this message. I am using the same code, the only thing I did was to update the version of the mavsdk and the mavsdk-server.
Thanks!