Search code examples
wear-osandroid-wear-data-apiandroid-wear-2.0android-wear-notification

Try to send HTTP Request to API Backend via Wear OS standalone app


I really need your help please. I have the following problem: I want to send data via a android Wear watch (with integrated sim card) using a standalone Wear OS app. I want, if a button is pressed that a http request is send to my backend server (not via the GoogleServices/API or something like this, I want it to get a direct network access).

The problem is that I do not find any working example projects for that task: sending a http request directly via wear os. My java experience is quit good but my android developer knowledge is low so I think a working example gives me the best chance to do a reverse engineering.


Solution

  • The thing to remember about Wear OS is that it's running on a (nearly) full Android device. So if what you're trying to do isn't something specifically covered by the Wear APIs, then you'll use standard Android techniques to get it done.

    In your case - for a standalone app looking to connect directly to a network server - you'll use the same connectivity tools as any non-watch Android device. Get started here: https://developer.android.com/training/basics/network-ops/