{"_id":"@alivepush/react-native-xg","_rev":"7-20aa67c15cf7780deb1a3de56d23b6f7","name":"@alivepush/react-native-xg","dist-tags":{"latest":"0.0.6"},"versions":{"0.0.1":{"name":"@alivepush/react-native-xg","version":"0.0.1","description":"<!-- badge --> [![npm version](https://img.shields.io/npm/v/@alivepush/react-native-xg.svg)](https://www.npmjs.com/package/@alivepush/react-native-xg) [![npm license](https://img.shields.io/npm/l/@alivepush/react-native-xg.svg)](https://www.npmjs.com/pack","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build:api":"documentation build ./index.js -f=md -g=true -o=./API.md"},"keywords":["react-native"],"author":"","license":"","peerDependencies":{"react-native":"^0.44.0"},"gitHead":"e4ef8ec807c54615f6d0bb92dade4df37b913c13","_id":"@alivepush/react-native-xg@0.0.1","_shasum":"bef8fc928184583c9f5937217329046dfdf395fb","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"alivepush","email":"alivepush@gmail.com"},"dist":{"shasum":"bef8fc928184583c9f5937217329046dfdf395fb","tarball":"https://registry.npmjs.org/@alivepush/react-native-xg/-/react-native-xg-0.0.1.tgz","fileCount":2672,"unpackedSize":38976616,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGLKLCRA9TVsSAnZWagAAAPYP/jaGMZnw8O3YsFNbaBrv\nLS0thpX0uvqIw+PBgg3Sb4cft0+9Fg/H7U7pMxfHw+B+LNyaTW5UNAlqfHfH\n5bHYiURqNlO/kyW3ePSsNMabwphoQ1JzRE31j+gLBC7CQbjDwAqBkOCiydK+\nN5wfdIFN0ShVLY4J8aOND9HQnHuFWxbelTV6LwFimGbb9sOHrvpd/O6omb8r\n4uZCX1j8xsbywwzHadMktqRZfeekhywVZsvbMCCxCt+Ur/zjyOqsZB7k3ovX\neRDnsA0tLAq7LjgsXFAg7ML1nMHSKx+/sKsMQVolUce8QED2NIxhuzVXdgoe\ndKskjA4LtUQm83g/veHaofpZafJ7y8bWhi0ulrxkE0FGmNEUuaX4Uc8DsStz\n4B92lcy5XW7GzEPl/FbmGGOzUWS6Ox37AW6Rv6amNR1fER4UrBgrmt9Qs+Hx\nupSF55VDcFrHTubLoYNakrpA/HHfRZceJTHXYukJhGSoWmU9wvdve/JivXCb\nE/PvLIMHQL8wt1tWTDMLVauEKjJ0YojzRSVGYkrBLqxg/lzHUXS7zsT2Nv2r\n4frn1kgP6wcqxfYlbilgZJ1yuBHsWjstaEDJWTVNpJ5FqvT2Jot2l/AuaG7H\nAhXotwME1NkyF6OwhEDOc+i1sZE1gPJX+hYEKa3BwVIrQbwio39n5YsaeBeS\npKZC\r\n=7KgU\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-Ly+1FQzYUr/7idokjSirYMcTUoukXumFyjzxXZpGdBghtMFJw5Kb9fTButPteRB+MxEj6eCJTZ9LPgzwyAfsVg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEo6NUJHDb/3sq7c4IjjwwtAdJM2Z0Qc4+rXocybZMEAAiB8Hk+vKGLzjZ5bWapnLFDTO4wRR3D0dsBcT+uxH8ft7Q=="}]},"maintainers":[{"name":"alivepush","email":"alivepush@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-xg_0.0.1_1528345225659_0.24073768038239374"},"_hasShrinkwrap":false},"0.0.2":{"name":"@alivepush/react-native-xg","version":"0.0.2","description":"react-native-xg封装了信鸽的推送API,集成了ios,android(包括华为,小米,魅族)的推送功能.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build:api":"documentation build ./index.js -f=md -g=true -o=./API.md"},"keywords":["react-native"],"author":"","license":"","peerDependencies":{"react-native":"^0.44.0"},"gitHead":"e239bba3b7d30e5567324e19c630362c168cfd94","_id":"@alivepush/react-native-xg@0.0.2","_shasum":"515a92cd198d83a9ebef2623fab4c6de644599ee","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"alivepush","email":"alivepush@gmail.com"},"dist":{"shasum":"515a92cd198d83a9ebef2623fab4c6de644599ee","tarball":"https://registry.npmjs.org/@alivepush/react-native-xg/-/react-native-xg-0.0.2.tgz","fileCount":2672,"unpackedSize":38990725,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbHhoVCRA9TVsSAnZWagAAL/kP/ja7h2k8WA2PD2uTjtRY\n1Bwl76uxAp6MeP39Vh/7iyNQ72S9BeLNyjOEphgo1Wmc/70IOV03QTPKZVfS\ng6T35KmUt3aQAiJ4ExHc46uq1MNy1+s0JjjGKTSfAFF1t4RMYFnIyVoYzJJv\nKRWfQgDby2BSLpBQYhqt6xbE61N2dreV7tVuD9PB9/FrX8seMr7LXDOzOkH8\nkxQIqhr+dwQkDCVt3nf/gHed64MN9Lg2yodMe/rDyxEs3gKo2FPVqzEq9koO\n1EaQe1BKAP4p022KeBGh4hVOtCPZnBKP6bdvikAYXAPRINhafGHVkaPdxchm\n66tnQJ2w2NQPyIxmlNU0lVj28LTZfjRc1v/jqSbKuC1pyKHFrJEIUaF9kZgS\n4CeeAwHN63YBZ98cfSWVpNI+LEeQq2qPP+7DFe4zFyAxpUFK7vK6TaqserDS\nmGwQ7EsvaohNwMpiDFjgv1o1vuEOOzWZaorW9WVMvtlokO8Jku+CGYCG0CTQ\nEwP1lWhU7ncleROHMxV1gZxrrPxIVrV+Gp0iK2X5KU8oZ32uM6+nL8KFB/cT\n/1cvbZPsH9A82pxHYDB1Ro4y9mIs8vxbhqUbqsU4r6pr0hbWyIp3ZpLmoE6A\npglXWP1NcRy17e8satDRgh9sTRDfusmrTDo000XzsEsvtHORL+OgutJpPjGo\nXbPH\r\n=VlcP\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-vKnrM5ClhhHHG4nrMiqssaFxbTgfMkaQEem9OBEcfphQUFCHQEfgKJEL6DAMF3oWSHdBX+ij+sz3d9Jmx0HMMg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFDOgxDt22QgqI/yWdd5+MUi82zQ4Rtll+S8OOwqnvMAIhAObPpNPg8uuC0mXPPX5LbQ9povEnZv5By8RqioEALguJ"}]},"maintainers":[{"name":"alivepush","email":"alivepush@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-xg_0.0.2_1528699412435_0.25420796576274984"},"_hasShrinkwrap":false},"0.0.3":{"name":"@alivepush/react-native-xg","version":"0.0.3","description":"react-native-xg封装了信鸽的推送API,集成了ios,android(包括华为,小米,魅族)的推送功能.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build:api":"documentation build ./index.js -f=md -g=true -o=./API.md"},"keywords":["react-native"],"author":"","license":"","peerDependencies":{"react-native":"^0.44.0"},"gitHead":"09adcc5ab5b764ffd9843204b8ccac9dd52c26dd","_id":"@alivepush/react-native-xg@0.0.3","_shasum":"bd1acd0e5f91d4b3f0494d6de35a7a12521b3c4e","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"alivepush","email":"alivepush@gmail.com"},"dist":{"shasum":"bd1acd0e5f91d4b3f0494d6de35a7a12521b3c4e","tarball":"https://registry.npmjs.org/@alivepush/react-native-xg/-/react-native-xg-0.0.3.tgz","fileCount":2674,"unpackedSize":47501149,"integrity":"sha512-wVbhOH1T+PY3gJq8TaXEgdfAIfU/hBPJcxXvVZqtREixaFGb3gP760qKHc4ecuPsyr7CEW5iJ6tiCJfXnIVDrg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDm/+4kVc7KUpKv2RfiV/z9yZNOnZ3l3T0xNzCaWtaavAiAV/5yZYHBonB7pGZjrknmvaLxkZyNhG6CMnDHVmbnuIw=="}]},"maintainers":[{"name":"alivepush","email":"alivepush@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-xg_0.0.3_1529045789595_0.06714933480933793"},"_hasShrinkwrap":false},"0.0.4":{"name":"@alivepush/react-native-xg","version":"0.0.4","description":"react-native-xg封装了信鸽的推送API,集成了ios,android(包括华为,小米,魅族)的推送功能.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build:api":"documentation build ./index.js -f=md -g=true -o=./API.md"},"keywords":["react-native"],"author":"","license":"","peerDependencies":{"react-native":"^0.44.0"},"gitHead":"02e854c5fb9e17d9453b4430e873049720ea2508","_id":"@alivepush/react-native-xg@0.0.4","_shasum":"bec4632f9abfa740db8224788fb6c71af04e61fb","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"alivepush","email":"alivepush@gmail.com"},"dist":{"shasum":"bec4632f9abfa740db8224788fb6c71af04e61fb","tarball":"https://registry.npmjs.org/@alivepush/react-native-xg/-/react-native-xg-0.0.4.tgz","fileCount":2674,"unpackedSize":47501091,"integrity":"sha512-S9eQpS9MP9IEZzx4WMsfJp2JYKFGWH7t/+uzdsYJepbY5gIwuPVipBLcziRpgAyKTY24NtzeQAouvfda7Bcpnw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH14TzmC7PSBj4UGOq1AqiXgudLDa9B4lNvl+BLyORlQAiEAhDo+MMV41ijODdh+jCjlgF8i+6F3Q5IgKafZIVACxR0="}]},"maintainers":[{"name":"alivepush","email":"alivepush@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-xg_0.0.4_1529391519609_0.8954694466227329"},"_hasShrinkwrap":false},"0.0.5":{"name":"@alivepush/react-native-xg","version":"0.0.5","description":"react-native-xg封装了信鸽的推送API,集成了ios,android(包括华为,小米,魅族)的推送功能.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build:api":"documentation build ./index.js -f=md -g=true -o=./API.md"},"keywords":["react-native"],"author":"","license":"","peerDependencies":{"react-native":"^0.44.0"},"gitHead":"3ade7ac0bcbb75664e7973210a098a9503d1a760","_id":"@alivepush/react-native-xg@0.0.5","_shasum":"49256a70a99e94186d52752b6409c9c540f3f36e","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"alivepush","email":"alivepush@gmail.com"},"dist":{"shasum":"49256a70a99e94186d52752b6409c9c540f3f36e","tarball":"https://registry.npmjs.org/@alivepush/react-native-xg/-/react-native-xg-0.0.5.tgz","fileCount":2674,"unpackedSize":47501569,"integrity":"sha512-fqX1CtA24db/71u4Us+ggia3GzSSTv71ypdcMhEiv4/eAJounqROEPpw1ttWIokmrd2Tj/FFrmrdMp+bQ4j0gw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCj6tZO0u0bRJa+gzzC5Elxh67yXwI2phfPB3OVBigfUQIgRdrBOPyYQJ7gkisvnxi0YklXLvsbVEv7i7QhLaWgmKs="}]},"maintainers":[{"name":"alivepush","email":"alivepush@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-xg_0.0.5_1529398823022_0.273296698990797"},"_hasShrinkwrap":false},"0.0.6":{"name":"@alivepush/react-native-xg","version":"0.0.6","description":"react-native-xg封装了信鸽的推送API,集成了ios,android(包括华为,小米,魅族)的推送功能.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build:api":"documentation build ./index.js -f=md -g=true -o=./API.md"},"keywords":["react-native"],"author":"","license":"","peerDependencies":{"react-native":"^0.44.0"},"gitHead":"9f05ca0d677ec7124d65139215767100ea4d1d31","_id":"@alivepush/react-native-xg@0.0.6","_shasum":"60304e1b17ec719953f957999a620e2cacf61ab3","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"alivepush","email":"alivepush@gmail.com"},"dist":{"shasum":"60304e1b17ec719953f957999a620e2cacf61ab3","tarball":"https://registry.npmjs.org/@alivepush/react-native-xg/-/react-native-xg-0.0.6.tgz","fileCount":2674,"unpackedSize":47502188,"integrity":"sha512-vPQP9awZzVF7wUTZ6vgXivtWd26ts8mQ+F7eMRAn6nrl7I3xrWlr/MOBBuGll6fPE+X4gR9JTZFwzTgf51ZcAQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE0OzSCp/2NZUv4S0CaXJkyGqFCeH/wD7DVqNlbYMGK6AiB/wArNL14EYkwI5/f28j3i9zF5SNzejwcchkolkkgNWQ=="}]},"maintainers":[{"name":"alivepush","email":"alivepush@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-xg_0.0.6_1529399691513_0.30474573070939437"},"_hasShrinkwrap":false}},"time":{"created":"2018-06-07T04:20:25.373Z","0.0.1":"2018-06-07T04:20:26.039Z","modified":"2022-06-12T14:31:33.262Z","0.0.2":"2018-06-11T06:43:33.106Z","0.0.3":"2018-06-15T06:56:30.621Z","0.0.4":"2018-06-19T06:58:40.208Z","0.0.5":"2018-06-19T09:00:23.667Z","0.0.6":"2018-06-19T09:14:52.408Z"},"maintainers":[{"name":"alivepush","email":"alivepush@gmail.com"}],"description":"react-native-xg封装了信鸽的推送API,集成了ios,android(包括华为,小米,魅族)的推送功能.","keywords":["react-native"],"readme":"\n# react-native-xg\n\nreact-native-xg封装了信鸽的推送API,集成了ios,android(包括华为,小米,魅族)的推送功能.\n\n- react-native-xg测试使用的是react-native@0.44.0进行测试的,如果在其他版本使用中有问题请在[issues](https://github.com/alivepush/react-native-xg/issues)中说明\n- android使用的信鸽版本为`com.tencent.xinge:xinge:3.2.4-beta`,对应的版本号可以在`android/build.gradle`中查看\n- 文档请参考[API Document & Examples](./API.md)\n- [app demo](https://github.com/alivepush/react-native-xg-example)\n\n<!-- badge -->\n[![npm version](https://img.shields.io/npm/v/@alivepush/react-native-xg.svg)](https://www.npmjs.com/package/@alivepush/react-native-xg)\n[![npm license](https://img.shields.io/npm/l/@alivepush/react-native-xg.svg)](https://www.npmjs.com/package/@alivepush/react-native-xg)\n[![npm download](https://img.shields.io/npm/dm/@alivepush/react-native-xg.svg)](https://www.npmjs.com/package/@alivepush/react-native-xg)\n[![npm download](https://img.shields.io/npm/dt/@alivepush/react-native-xg.svg)](https://www.npmjs.com/package/@alivepush/react-native-xg)\n<!-- endbadge -->\n\n## Getting started\n\n`$ npm install @alivepush/react-native-xg --save`\n\n### Mostly automatic installation\n\n`$ react-native link @alivepush/react-native-xg`\n\n### Manual installation\n\n\n#### iOS\n\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ `react-native-xg` and add `RNReactNativeXg.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libRNReactNativeXg.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4. Run your project (`Cmd+R`)<\n\n#### Android\n\n1. Open up `android/app/src/main/java/[...]/MainActivity.java`\n  - Add `import com.alivepush.xg.RNReactNativeXgPackage;` to the imports at the top of the file\n  - Add `new RNReactNativeXgPackage()` to the list returned by the `getPackages()` method\n2. Append the following lines to `android/settings.gradle`:\n  \t```\n  \tinclude ':react-native-xg'\n  \tproject(':react-native-xg').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-xg/android')\n  \t```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n      compile project(':react-native-xg')\n  \t```\n\n## 集成\n\n### android配置\n\n修改`build.gradle`配置文件\n\n```gradle\nandroid {\n    defaultConfig {\n        manifestPlaceholders = [\n            //可选填,可以通过代码进行设置\n            XG_ACCESS_ID : \"\",\n            //可选填,可以通过代码进行设置\n            XG_ACCESS_KEY: \"\",\n            //可选填,如果需要使用华为推送就必须填写\n            HW_APPID     : \"\",\n            //可选填,如果需要使用小米推送就必须填写\n            PACKAGE_NAME : \"\"\n        ]\n    }\n}\n```\n\n### React Native 实现\n\n#### 使用快速注册接口\n\n```javascript\nimport React,{Component} from \"react\"\nimport {View} from \"react-native\"\nimport xg from '@alivepush/react-native-xg'\n\nclass App extends Component{\n    render(){\n        //do something\n    }\n    componentDidMount(){\n        /*\n          默认开启第三方推送服务\n          如果accessid和accesskey已经配置过了,可以直接传递null\n          如:\n\n          xg.register(\"miAppId\",\"miAppKey\",\"mzAppId\",\"mzAppKey\",null,null,debug,(token,code)=>{\n              console.log(`code=${code},token=${token}`);\n          })\n\n        */\n        xg.register(\"miAppId\",\"miAppKey\",\"mzAppId\",\"mzAppKey\",\"access_id\",\"access_key\",debug,(token,code)=>{\n            console.log(`code=${code},token=${token}`);\n        })\n    }\n}\n```\n#### 单步实现信鸽推送\n\n```javascript\nimport React,{Component} from \"react\"\nimport {View} from \"react-native\"\nimport xg from '@alivepush/react-native-xg'\n\nclass App extends Component{\n    render(){\n        //do something\n    }\n    componentDidMount(){\n\n        //开启日志\n        //PS:当发布到生产环境时最好不要开启日志\n        //这里其实可以根据环境变量来确定是否开启日志\n        //xg.enableDebug(process.env.NODE_ENV===\"development\");\n        xg.enableDebug(true);\n\n        //设置access id\n        xg.setAccessId(\"ACCESS_ID\");\n\n        //设置access key\n        xg.setAccessKey(\"ACCESS_KEY\");\n\n        //如果需要监听注册的回调有两种方式\n        //第一种:xg.addListener(\"registerresult\",()=>{})\n        //第二种:xg.registerPush(()=>{});\n        //这里我们使用第一种\n        const listener=xg.addListener(\"registerresult\",(...args)=>{\n            listener.remove();\n            console.log(\"注册结果\",args);\n        })\n\n        //开始注册\n        xg.registerPush();\n\n        //如果我们是点击通知栏触发的app启动需要监听`fetchLastClickMessage`\n        xg.fetchLastClickMessage(message=>{\n            //可以处理通知栏过来的消息\n        });\n    }\n}\n```\n\n\n  ","readmeFilename":"README.md"}