I'm developing my first android wear
application and I'm doing a request to an api
, the problem is that I don't have internet connection. How can I enable the internet connection or something like that?
so far what I have tried is enable the bluetooth connection but every time I click there I get the following error Unfortunately, settings has stopped.
any idea how to fix it?
Note: below is my virtual machine details:
EDITED Also to make sure the internet connection is not working I have tried the code below:
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
if (ni == null) {
// There are no active networks.
return false;
} else
return true;
Yes as it is documented that a wear does not have the direct access to internet so you cant call the API directlly from android wear.
There is a work around which i have used in one app i recently developed in wear.
You have to user the Message API for the android device and wear. Using this you can communicate with device and wear.
You can pass the action in Message API from device to wear. So what you can do is based on a specific action you can pass control to device call the API got the data and pass the required data to wear and do the operation you need.
And yes it is important that Google Play service is same or updated on both android device and wear (Device or Emulator) otherwise it will throw exception.
Thanks.