npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-wear-communication-module

v1.0.3

Published

Description

Readme

React-Native Wear Communication Module

React-Native Wear Communication Module is a Native Module for React-Native applications that lets RN applications communicate with WearOS devices through native Data-Client API. More information here. This module is very helpful if you're developing an application used on an Android phone and a helper application used on a WearOS Smart Watch.

Authors

Nikola Krezeski

Ivan Janjikj

Before you start

Make sure that both of your applications:

  • Share the same package name everywhere in the project (AndroidManifest, build.gradle, the project files etc.)
  • Share the same applicationId in build.gradle
  • Are signed with the same key (for development and debugging both of the applications can be unsigned, triple check this, as you can lose a lot of time if not done right)

Triple check the above steps !!!

Installation

npm install react-native-wear-communication-module

Usage

Sending data to a Client

Use case: You need to login a user and take accessToken and validTo timestamp from a remote server. You can use axios to make the request, and then you can pass the data as a JS Object. The sendDataToClient function receives only one parameter of type Object, so you can pass any data as long as it is bundled as an Object. The method is generic and will pass any data to the client.

import { sendDataToClient } from "react-native-wear-communication-module";


axios.post("URL").then(({data}) => {
  const accessToken = data?.accessToken
  const validTo = data?.validTo
  sendDataToClient({"accessToken": accessToken, "validTo": validTo})
}).catch((err) => console.error(err))

Receiving data from a Client

Use case: The client needs to submit a query to the React-Native application, so the RN application will then for example fetch the accessToken and send it back to the client.

For this you need to register a listener using the DeviceEventEmitter. You also need to get the name of the Event, for which you can use an exported function of the module.

import { getRNEventName } from "react-native-wear-communication-module";
import { DeviceEventEmitter } from 'react-native';


const onReceiveEventHandler = () => {
  // Some logic
  // You would probably want to use the sendDataToClient function here, but not necessarily,
  // You can use the listener for any logic that you need in the application
}

useEffect(() => {
  DeviceEventEmitter.addListener(getRNEventName(), onReceiveEventHandler);
}, [])

Receiving and Sending data on the WearOS Application

For receiving data on the WearOS application please refer here

Note: First read the above link, then -

  • To successfully send data to the React-Native application make a request to: "/data-query" using the native Data-Client
  • For receiving data on the WearOS application, you need to listen on this path: "/data-response"

If more people request (if unclear), we will include more information on the Wear OS application side in the future.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT