@@ -57,10 +57,6 @@ npm install react-native-azurenotificationhub
57
57
58
58
![ Create Notification Hub] ( img/CreateNotificationHub.png )
59
59
60
- * Take note of the two connection strings that are made available to you in ** Settings > Access Policies** , as you will need them to handle push notifications later.
61
-
62
- ![ Get Connection String] ( img/GetConnectionString.png )
63
-
64
60
## Android Installation
65
61
66
62
### Register app with Notification Hub
@@ -218,19 +214,34 @@ namespace ...
218
214
}
219
215
```
220
216
221
- * At this point you can register and unregister from the Azure Notification Hub instance using JavaScript as in the following example:
217
+ ## iOS Installation
218
+
219
+ Coming soon.
220
+
221
+ ## JavaScript Configuration
222
+
223
+ On the [ Azure Portal] ( https://portal.azure.com ) page for your notification hub, copy a connection string from ** Settings > Access Policies** .
224
+
225
+ ![ Get Connection String] ( img/GetConnectionString.png )
226
+
227
+ The example below shows how you can register and unregister from Azure Notification Hub in your React component.
222
228
223
229
``` js
224
230
const NotificationHub = require (' react-native-azurenotificationhub' );
225
231
232
+ const connectionString = ' ...' ; // The Notification Hub connection string
233
+ const hubName = ' ...' ; // The Notification Hub name
234
+ const senderID = ' ...' ; // The Sender ID from the Cloud Messaging tab of the Firebase console
235
+ const tags = [ ... ]; // The set of tags to subscribe to
236
+
226
237
class myapp extends Component {
227
238
register () {
228
- NotificationHub .register ({connectionString, hubName})
239
+ NotificationHub .register ({connectionString, hubName, senderID, tags })
229
240
.catch (reason => console .warn (reason));
230
241
}
231
242
232
243
unregister () {
233
- NotificationHub .unregister ({connectionString, hubName} )
244
+ NotificationHub .unregister ()
234
245
.catch (reason => console .warn (reason));
235
246
}
236
247
@@ -256,14 +267,6 @@ class myapp extends Component {
256
267
}
257
268
` ` `
258
269
259
- ## iOS Installation
260
-
261
- Coming soon.
262
-
263
- ## JavaScript Configuration
264
-
265
- Coming soon.
266
-
267
270
## License
268
271
269
272
The React Native Azure Notification Hub plugin is provided under the [MIT License](LICENSE).
0 commit comments