receive UDP data on Google Glass with GDK

前端 未结 2 985
后悔当初
后悔当初 2021-01-25 02:13

Any recommendations for receiving UDP data from an app running on Google Glass?

I need to integrate with an existing system. This system does UDP broadcasts to the loca

2条回答
  •  抹茶落季
    2021-01-25 02:49

    According to GDK welcome page:

    We designed the Glass platform to make the existing Android SDK just work on Glass. This lets you code in a familiar environment, but for a uniquely novel device.

    In addition, you can use all of the existing Android development tools, and your Glassware is even delivered as a standard Android package (APK).

    So, presumably you should be able to do something along the lines of (untested):

    byte[] buf = new byte[1024];
    DatagramSocket socket = new DatagramSocket(port);
    DatagramPacket packet = new DatagramPacket(buf, buf.length);
    socket.receive(packet);
    

    DatagramSocket reference

提交回复
热议问题