# react-native-get-channel

> React Native bridging library for android to get app channel

Latest version **1.0.1** (published 2018-12-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-get-channel
pnpm add react-native-get-channel
yarn add react-native-get-channel
bun add react-native-get-channel
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-12-08 |
| First published | 2018-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | superhao |
| Maintainers | superhao |
| Keywords | android, channel, react-native, react |

## Links

- npm: https://www.npmjs.com/package/react-native-get-channel
- Repository: https://github.com/1556173267/react-native-get-channel
- Homepage: https://github.com/1556173267/react-native-get-channel#readme
- Issues: https://github.com/1556173267/react-native-get-channel/issues
- npm.io page: https://npm.io/package/react-native-get-channel

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-12-08
- 1.0.0 — 2018-12-08

## README

# react-native-get-channel
React Native bridging library for android to get app channel

## install

```
npm install react-native-get-channel --save
```

## Android

### Automatic

```
react-native link react-native-get-channel
```

### Manually

* android/settings.gradle

```
include ':react-native-get-channel'
project(':react-native-get-channel').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-get-channel/android')
```

* android/app/build.gradle

```
dependencies {
    compile project(':react-native-get-channel')
}
```

* register module (in MainActivity.java)

```java
...

import com.superhao.react_native_get_channel.GetChannelPackage; // <--- IMPORT

public class MainActivity extends ReactActivity {

    ...

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new GetChannelPackage() // <--- ADD HERE
        );
    }
    
    ...

```

## General Usage

* Add channel information into AndroidManifest.xml
```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ownmoduletest">
    ...
    <application
      ...
      <meta-data android:name="JPUSH_APPKEY" android:value="12.324"/> // <--- ADD HERE
      ...
    </application>
    ...
</manifest>

```

```javascript
import {getAppMetaData} from 'react-native-get-channel';
```

```javascript
  _getChannel = ()=> {
    getAppMetaData('JPUSH_APPKEY').then((data)=>{
      alert(data);
    }).catch((error)=>{
      alert('获取失败');
    });
  }

```

---
_Source: https://npm.io/package/react-native-get-channel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
