waleedAhmad1 / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

Support WiFi Direct #392

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It appears that WiFi Direct is not supported. Is it in the plans to support?

WifiP2pManager mManager = (WifiP2pManager) 
getSystemService(Context.WIFI_P2P_SERVICE);
WifiP2pManager.Channel mChannel = mManager.initialize(this, getMainLooper(), 
null);
mManager.requestConnectionInfo(mChannel, new 
WifiP2pManager.ConnectionInfoListener() {
    @Override
    public void onConnectionInfoAvailable(WifiP2pInfo info) {
        Toast.makeText(MyActivity.this, "onConnectionInfoAvailable", Toast.LENGTH_LONG).show(); // this gets called
        mManager.discoverPeers(mChannel, new WifiP2pManager.ActionListener() {
            @Override
            public void onSuccess() {
                Log.i("Wifi-P2P", "Peer discovery succeeded");
                mManager.requestPeers(mChannel, new WifiP2pManager.PeerListListener() {
                    @Override
                    public void onPeersAvailable(WifiP2pDeviceList peers) {
                        Log.i("Wifi-P2P", "Discovered " + peers.getDeviceList().size() + " peers");
                    }
                });
            }

            @Override
            public void onFailure(int reason) {
                Log.e("Wifi-P2P", "Failed with: " + reason); // gets called with 1 (P2P_UNSUPPORTED)
            }
        });
    }
});

Original issue reported on code.google.com by eug...@wearableintelligence.com on 29 Jan 2014 at 11:55

GoogleCodeExporter commented 8 years ago
This was Glass-1-XE12.

The above is part of the 3 things I tried in verifying its availability. Thus, 
I also tried to set up a receiver - no messages were passed, - and adding this 
in the Manifest:

 <uses-feature android:name="android.hardware.wifi.direct" android:required="true"/>
Also failed.

With respect to the latter, should the app not start if Wifi Direct is 
unavailable? It does start.

Original comment by eug...@wearableintelligence.com on 30 Jan 2014 at 12:03

GoogleCodeExporter commented 8 years ago
Regarding the <uses-feature> tag, this is used by Google Play (for Android 
apps) to filter out applications that use features that are not supported by 
your devices.

Original comment by ala...@google.com on 30 Jan 2014 at 12:25

GoogleCodeExporter commented 8 years ago
Is there a work around for this atm?  Root and recompile with custom drivers?  

Original comment by waggo...@gxmconsulting.com on 10 Feb 2014 at 4:24

GoogleCodeExporter commented 8 years ago
Issue 403 has been merged into this issue.

Original comment by ala...@google.com on 10 Feb 2014 at 4:27

GoogleCodeExporter commented 8 years ago
Is there any work around or upcoming release for this feature? I'm running 
XE17.3 and the app seems to be unable to use Wi-Fi Direct (or Wifi P2P)

The application itself compiles and runs as expected on a tablet. However, 
trying to compile and run the same application on Glass gives the error of not 
being supported. This is logged several times, here's one example of an error.

 mManager.discoverServices(mChannel, new WifiP2pManager.ActionListener() {

            @Override
            public void onSuccess() {
                // Success!
                Log.d(TAG, "Discover Services Good");
            }

            @Override
            public void onFailure(int code) {
                // Command failed.  Check for P2P_UNSUPPORTED, ERROR, or BUSY
                switch(code) {
                    case WifiP2pManager.P2P_UNSUPPORTED:
                        Log.d(TAG, "Discover Services Error - P2P isn't supported on this device.");
                        break;
                    case WifiP2pManager.ERROR:
                        Log.d(TAG, "Discover Services Error - An Error Occurred");
                        break;
                    case WifiP2pManager.BUSY:
                        Log.d(TAG, "Discover Services Error - Manager is currently busy");
                        break;
                }
            }
        }); mManager.discoverServices(mChannel, new WifiP2pManager.ActionListener() {

            @Override
            public void onSuccess() {
                // Success!
                Log.d(TAG, "Discover Services Good");
            }

            @Override
            public void onFailure(int code) {
                // Command failed.  Check for P2P_UNSUPPORTED, ERROR, or BUSY
                switch(code) {
                    case WifiP2pManager.P2P_UNSUPPORTED:
                        Log.d(TAG, "Discover Services Error - P2P isn't supported on this device.");
                        break;
                    case WifiP2pManager.ERROR:
                        Log.d(TAG, "Discover Services Error - An Error Occurred");
                        break;
                    case WifiP2pManager.BUSY:
                        Log.d(TAG, "Discover Services Error - Manager is currently busy");
                        break;
                }
            }
        });

Original comment by Han...@gmail.com on 10 Jun 2014 at 3:11