Device discovery on Android (3.2 tablet)

igor
2012-03-01
2013-05-02
  • igor
    igor
    2012-03-01

    Hi,
    iam trying to make simple android application, which can discover upnp device, using this sdk. I have included clink library in my project, granted following permissions

    CHANGE_WIFI_MULTICAST_STATE
    ACCESS_WIFI_STATE
    CHANGE_WIFI_STATE
    INTERNET    
    CHANGE_NETWORK_STATE
    

    Here is main part of program

           WifiManager wm = (WifiManager)getSystemService( Context.WIFI_SERVICE );
           if(wm != null)
           {
               MulticastLock mcLock = wm.createMulticastLock("mylock");
               mcLock.acquire();
               
              ControlPoint cp = new ControlPoint(1900, 2869);
                cp.start();
                int i = cp.getDeviceList().size();
                cp.stop();
           }
    

    but i keep getting this exception Null pointer exception
    03-01 12:24:59.590: E/AndroidRuntime(3598): at org.cybergarage.upnp.ssdp.SSDPSearchResponseSocket.start(SSDPSearchResponseSocket.java:87)
    Any idea where the problem is? :)

     
  • igor
    igor
    2012-03-01

    i am running demo application on actual android device (emulator doesnt support multicast)