dzografi
dzografi

Reputation: 31

Cling UPnP library for Android. Not seeing devices after shutdown and restart

I am using the cling library for android to locate and control other mobile devices in my WiFi network. I have downloaded and imported (in Eclipse) the Cling Browser and Cling Switch Power Examples and they work fine until I exit the Switch power app from my remote device and start it again.

Afterwards, it is never again visible inside the Cling Browser App. The only way to make the device appear again inside the browser, is to force stop the Power Switch App from inside the apps menu of android settings and start it again.

Is there a possibility that the AndroidUpnpServiceImpl isn't shutting down correctly? I have tried to first unbind and then also stop the service using stopService() but still nothing.
I have tested on several devices, all using Android 4.1 and 4.4. and I have noticed the same behavior. Am I doing something wrong?

Thank you in advance

I forgot to mention that I can see the logs of UPnPServiceImpl:
>>> Shutting down UPnP service...
<<< UPnP service shutdown completed
which indicates that the service must have properly shut down.

Upvotes: 2

Views: 1058

Answers (1)

cV2
cV2

Reputation: 5317

I've found some solution, but it was unfortunately some problem inside the cling library. some colluegue of mine did the fix, I'm not able to share the "patches library" and it's not clear what changes were affected. We used a patched version of: cling-distribution-2.0.1

So possibly with latest lib it's also already fixed? Good luck! Did u test it already with 2.0.1?

So problem was: successful run from library code:

07-17 17:53:23.205  14826-14826/ I/DatagramIO﹕ Creating bound socket (for datagram input/output) on: 192.168.1.110/192.168.1.110
    07-17 17:53:23.205  14826-14826/ I/StreamServer﹕ Setting executor service on servlet container adapter
    07-17 17:53:23.205  14826-14826/ I/StreamServer﹕ Adding connector: 109.46.235.174/109.46.235.174:0
    07-17 17:53:23.205  14826-14826/ D/libc-netbsd﹕ [getaddrinfo]: hostname=xxxxx; servname=(null); cache_mode=(null), netid=0; mark=0
    07-17 17:53:23.205  14826-14826/ D/libc-netbsd﹕ [getaddrinfo]: ai_addrlen=0; ai_canonname=xxxxx; ai_flags=4; ai_family=0
    07-17 17:53:23.205  14826-14826/ I/pnpServiceConfiguration﹕ Thread pool rejected execution of class org.eclipse.jetty.server.AbstractConnector$Acceptor
    07-17 17:53:23.205  14826-14826/ W/System.err﹕ 2015-07-17 17:53:23.215:INFO:oejs.AbstractConnector:Started [email protected]:60087
    07-17 17:53:23.205  14826-14826/ I/DatagramIO﹕ Creating bound socket (for datagram input/output) on: 109.46.235.174/109.46.235.174
    07-17 17:53:23.205  14826-14826/ I/StreamClient﹕ Starting Jetty HttpClient...
    07-17 17:53:23.205  14826-14826/ I/Router﹕ WiFi multicast lock acquired
    07-17 17:53:23.205  14826-14826/ I/Router﹕ Created WiFi lock, mode: 3
    07-17 17:53:23.205  14826-14826/ I/Router﹕ WiFi lock acquired
    07-17 17:53:23.215  14826-14826/ I/UpnpServiceImpl﹕ <<< UPnP service started successfully

error run was something like this:

07-17 17:53:23.205  14826-14826/ I/StreamClient﹕ Starting Jetty HttpClient...
07-17 17:53:23.205  14826-14826/ I/Router﹕ WiFi multicast lock acquired
07-17 17:53:23.205  14826-14826/ I/Router﹕ Created WiFi lock, mode: 3
07-17 17:53:23.205  14826-14826/ I/Router﹕ WiFi lock acquired
07-17 17:53:23.205  14826-14826/ I/DatagramIO﹕ Creating bound socket (for datagram input/output) on: 192.168.1.110/192.168.1.110
    07-17 17:53:23.205  14826-14826/ I/StreamServer﹕ Setting executor service on servlet container adapter
    07-17 17:53:23.205  14826-14826/ I/StreamServer﹕ Adding connector: 109.46.235.174/109.46.235.174:0
    07-17 17:53:23.205  14826-14826/ D/libc-netbsd﹕ [getaddrinfo]: hostname=xxxxx; servname=(null); cache_mode=(null), netid=0; mark=0
    07-17 17:53:23.205  14826-14826/ D/libc-netbsd﹕ [getaddrinfo]: ai_addrlen=0; ai_canonname=xxxxx; ai_flags=4; ai_family=0
    07-17 17:53:23.205  14826-14826/ I/pnpServiceConfiguration﹕ Thread pool rejected execution of class org.eclipse.jetty.server.AbstractConnector$Acceptor
    07-17 17:53:23.205  14826-14826/ W/System.err﹕ 2015-07-17 17:53:23.215:INFO:oejs.AbstractConnector:Started [email protected]:60087
    07-17 17:53:23.205  14826-14826/ I/DatagramIO﹕ Creating bound socket (for datagram input/output) on: 109.46.235.174/109.46.235.174
    07-17 17:53:23.215  14826-14826/ I/UpnpServiceImpl﹕ <<< UPnP service started successfully

Upvotes: 0

Related Questions