Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin Apple Watch Extension - Consuming simple JSON Web Service

I've built a simple Xamarin.forms app which connects to a web service and gets one piece of data and displays it.

I wanted to do the same on an apple watch (targetting a series 2 apple watch) but I just don't understand how it works.

I've added the watch project and the watch extension, created the interface... Got a "refresh" button which changes the value of the label to a hard coded value but I want to get the data from a simple web service on app startup on wake and when button is activated (similar to my xamarin.forms iphone app)

I've tried using the classes that I use on the forms app to get the data but I can't reference them. I've tried using httpclient and that doesn't work.

After googling it appears I am suppose to use a HandleWatchKitExtensionRequest delegate in the phone app to get the data in a dictionary and then display the data. I haven't been able to find any really simple examples of this, but I'm confused because since apple watch version 3 the watch has been autonomous with cell access and therefore it doesn't have the host app necessarily.

So what I'm asking, is can the watch actually consume a web service alone using a xamarin phone app and if so, is there any simple examples because I can't find any (that aren't from 2015).

Sorry if this is vague, or I sound like a newbie (I definitely am a newbie when it comes to xamarin but any pointers or help would be appreciated)

Answers

Sign In or Register to comment.