@@ -82,7 +82,77 @@ npm install react-native-azurenotificationhub
82
82
83
83
### Export React Native Module from app
84
84
85
- Coming soon.
85
+ In ` android/settings.gradle `
86
+
87
+ ``` gradle
88
+ ...
89
+
90
+ include ':react-native-azurenotificationhub'
91
+ project(':react-native-azurenotificationhub').projectDir = file('../node_modules/react-native-azurenotificationhub/android')
92
+ ```
93
+
94
+ In ` android/app/build.gradle `
95
+
96
+ ``` gradle
97
+ ...
98
+ dependencies {
99
+ ...
100
+
101
+ compile project(':react-native-azurenotificationhub')
102
+ compile 'com.google.android.gms:play-services-gcm:9.4.0'
103
+ compile 'com.google.firebase:firebase-messaging:9.4.0'
104
+ }
105
+ ```
106
+
107
+ In ` android/app/src/main/AndroidManifest.xml `
108
+
109
+ ``` xml
110
+ ...
111
+
112
+ <uses-permission android : name =" android.permission.INTERNET" />
113
+ <uses-permission android : name =" android.permission.GET_ACCOUNTS" />
114
+ <uses-permission android : name =" com.google.android.c2dm.permission.RECEIVE" />
115
+
116
+ <application ...>
117
+ ...
118
+ <service
119
+ android : name =" com.azure.reactnative.notificationhub.ReactNativeRegistrationIntentService"
120
+ android : exported =" false" >
121
+ </service >
122
+ <receiver android : name =" com.microsoft.windowsazure.notifications.NotificationsBroadcastReceiver"
123
+ android : permission =" com.google.android.c2dm.permission.SEND" >
124
+ <intent-filter >
125
+ <action android : name =" com.google.android.c2dm.intent.RECEIVE" />
126
+ </intent-filter >
127
+ </receiver >
128
+ ...
129
+ ```
130
+
131
+ Register the module package in ` MainApplication.java `
132
+
133
+ ``` java
134
+ import com.azure.reactnative.notificationhub.ReactNativeNotificationHubPackage ;
135
+
136
+ public class MainApplication extends Application implements ReactApplication {
137
+
138
+ private final ReactNativeHost mReactNativeHost = new ReactNativeHost (this ) {
139
+ @Override
140
+ protected boolean getUseDeveloperSupport () {
141
+ return BuildConfig . DEBUG ;
142
+ }
143
+
144
+ @Override
145
+ protected List<ReactPackage > getPackages () {
146
+ return Arrays . < ReactPackage > asList(
147
+ new MainReactPackage (),
148
+ new ReactNativeNotificationHubPackage () // <-- Add this package
149
+ );
150
+ }
151
+ };
152
+
153
+ ...
154
+ }
155
+ ```
86
156
87
157
## Windows Installation
88
158
@@ -123,17 +193,29 @@ Coming soon.
123
193
* In ** MainPage.cs** of your Windows Store app, add the the ` ReactAzureNotificationHubPacakge ` to your configured set of packages:
124
194
125
195
``` c#
196
+ using ReactWindowsAzureNotificationHub ;
197
+
198
+ namespace ...
199
+ {
200
+ public class MainPage : ReactPage
201
+ {
202
+ ...
203
+
126
204
public override List <IReactPackage > Packages
127
205
{
128
206
get
129
207
{
130
208
new List <IReactPackage >
131
209
{
132
210
new MainReactPackage (),
133
- new ReactAzureNotificationHubPackage (), // Also add using ReactWindowsAzureNotificationHub;
211
+ new ReactAzureNotificationHubPackage (), // <-- Add this package
134
212
}
135
213
}
136
214
}
215
+
216
+ ...
217
+ }
218
+ }
137
219
```
138
220
139
221
* At this point you can register and unregister from the Azure Notification Hub instance using JavaScript as in the following example:
0 commit comments