You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,33 +24,6 @@ Package Manager Console:
24
24
Install-Package CorePush
25
25
```
26
26
27
-
## Setup for ASP.NET Core with Dependency Injection
28
-
29
-
Both `ApnSender` and `FirebaseSender` have dependencies that need to be registered in order to enable DI.
30
-
31
-
1. Register HttpClient in Startup.cs. This will allow injection of HttpClient into the FCM and APN senders:
32
-
33
-
```
34
-
services.AddHttpClient<FirebaseSender>();
35
-
services.AddHttpClient<ApnSender>();
36
-
```
37
-
38
-
2. Register settings object as a singleton:
39
-
40
-
If you've added ApnSettings and FcmSettings into a configuration section, you can bind section directly to settings object from `IConfiguration` available in Startup.cs:
41
-
42
-
```
43
-
var section = configuration.GetSection("ApnSettings");
44
-
var settings = new AppSettings();
45
-
section.Bind(settings);
46
-
```
47
-
48
-
Add settings to services:
49
-
```
50
-
services.AddSingleton(apnSettings);
51
-
services.AddSingleton(fcmSettings);
52
-
```
53
-
54
27
# Firebase Cloud Messages for Android, iOS and Web
55
28
56
29
To start sending Firebase messages you need to have Google Project ID and JWT Bearer token. Steps to generate JWT bearer token:
@@ -147,6 +120,33 @@ public class AppleNotification
147
120
```
148
121
Use `[JsonProperty("alert-type")]` attribute to serialize C# properties into JSON properties with dashes.
149
122
123
+
# Setup for ASP.NET Core with Dependency Injection
124
+
125
+
Both `ApnSender` and `FirebaseSender` have dependencies that need to be registered in order to enable DI.
126
+
127
+
1. Register HttpClient in Startup.cs. This will allow injection of HttpClient into the FCM and APN senders:
128
+
129
+
```
130
+
services.AddHttpClient<FirebaseSender>();
131
+
services.AddHttpClient<ApnSender>();
132
+
```
133
+
134
+
2. Register settings object as a singleton:
135
+
136
+
If you've added `ApnSettings` and `FirebaseSettings` into a configuration section, you can bind section directly to settings object from `IConfiguration` available in Startup.cs:
137
+
138
+
```
139
+
var section = configuration.GetSection("ApnSettings");
0 commit comments