🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-native-handle-broadcast

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-handle-broadcast

React Native Handle Broadcast

0.1.6
latest
Source
npm
Version published
Weekly downloads
4
-20%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-broadcast-receiver

Native module for handle android broadcast

Installation

npm install react-native-handle-broadcast

Usage

1. Configure AndroidManifest.xml

<receiver android:name="com.handlebroadcast.BroadcastReceiverReceiver" android:enabled="true" android:exported="true">
  <intent-filter android:priority="1000">
    <action android:name="com.zzzz.yyyy.action" />
    <category android:name="android.intent.category.DEFAULT"></category>
  </intent-filter>
</receiver>

2. Listen to broadcast events (with custom intent actions and extraDataKey)

import { BroadcastReceiver } from 'react-native-handle-broadcast';

BroadcastReceiver.setIntentActionConfig([
  { action: 'com.zzzz.yyyy.action', datakey: '<data_key>' },
]);

React.useEffect(() => {
  const sub = BroadcastReceiver.addEventListener((data) =>
    console.log(data);
  );
  return () => sub.remove();
}, []);

Contributing

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

License

MIT

Made with create-react-native-library

Keywords

react-native

FAQs

Package last updated on 10 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts