2

As an android wear developer, Can we directly access network through http request ? In my case, I want to send a http request to get Yahoo Financial API stock data, but it always fails,

Same conditions In stackoverflow Does Android Wear support HttpURLConnection - getting EOFException Direct internet connection on Android Wear?

But in latest Android 5.1.1 Update shows "Wifi Support feature" http://officialandroid.blogspot.tw/2015/04/android-wear-wear-what-you-want-get.html

It means that Wifi feature in Android Wear just for "sync data" between phone and wear, or we can do more things on wifi ?

Thanks

Community
  • 1
  • 1
Hsiao yen
  • 71
  • 1
  • 5

2 Answers2

9

WiFi means that you'll be able to use the Wear Data Layer APIs (MessageApi, DataApi, ChannelApi, etc) when your phone and Wear device are not directly connected via Bluetooth.

Edit: While attached on wifi, you will be able to do direct HTTP requests - however do note that once reconnected to Bluetooth, that ability is removed so ensure that if you do take advantage of that additional functionality, you ensure your app works equally well in both situations (or has the appropriate fallback behavior/warnings to the user).

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • 1
    Yes, you are right. I get the same answer in Android Wear Developer Community. https://plus.google.com/communities/113381227473021565406 1. WiFi only means that you'll be able to use the Wear Data Layer APIs (MessageApi, DataApi, ChannelApi, etc) when your phone and Wear device are not directly connected via Bluetooth. 2. Stick to Data Layer API , you cannot send http request directly from watch. Fetch internet data from the phone, then transfer it to watch with Data Layer API. – Hsiao yen Jul 07 '15 at 05:46
  • ive been looking forever to confirm this... is it still true in 2019? – axa Mar 13 '19 at 22:04
  • 1
    @axa - all Wear 2.0 devices support WiFi at all times. – ianhanniballake Mar 13 '19 at 22:27
1

There is no limitation on your wifi in terms of restricting calls that it can make; when you are disconnected from your phone, and your wifi is on, you can definitely make internet calls through your wifi; you can test that by writing a simple application that makes an http call. However, it is best not to rely on wifi for that purpose since wifi is often not available and unless you take adequate measures to ensure there is a fallback, users of your app may be disappointed.

Ali Naddaf
  • 16,951
  • 2
  • 21
  • 28