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
+37-50Lines changed: 37 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,29 @@ The pure [Capacitor](https://capacitorjs.com/) plugin for [OneSignal](https://on
4
4
5
5
## Install
6
6
7
+
Install with your package manager of choice:
8
+
7
9
```bash
10
+
# with vp
11
+
vp add @onesignal/capacitor-plugin
12
+
13
+
# with bun
14
+
bun add @onesignal/capacitor-plugin
15
+
16
+
# with npm
8
17
npm install @onesignal/capacitor-plugin
18
+
```
19
+
20
+
Then sync Capacitor:
21
+
22
+
```bash
23
+
# with vp
24
+
vpx cap sync
25
+
26
+
# with bun
27
+
bunx cap sync
28
+
29
+
# with npm
9
30
npx cap sync
10
31
```
11
32
@@ -24,13 +45,13 @@ See the `examples/demo` directory for a full working example.
24
45
25
46
<docgen-index>
26
47
27
-
*[`initialize(...)`](#initialize)
28
-
*[`login(...)`](#login)
29
-
*[`logout()`](#logout)
30
-
*[`setConsentRequired(...)`](#setconsentrequired)
31
-
*[`setConsentGiven(...)`](#setconsentgiven)
32
-
*[Interfaces](#interfaces)
33
-
*[Type Aliases](#type-aliases)
48
+
-[`initialize(...)`](#initialize)
49
+
-[`login(...)`](#login)
50
+
-[`logout()`](#logout)
51
+
-[`setConsentRequired(...)`](#setconsentrequired)
52
+
-[`setConsentGiven(...)`](#setconsentgiven)
53
+
-[Interfaces](#interfaces)
54
+
-[Type Aliases](#type-aliases)
34
55
35
56
</docgen-index>
36
57
@@ -51,8 +72,7 @@ Initialize the SDK with your OneSignal app ID. Call during app startup.
51
72
| ----------- | ------------------- |
52
73
|**`appId`**| <code>string</code> |
53
74
54
-
--------------------
55
-
75
+
---
56
76
57
77
### login(...)
58
78
@@ -66,8 +86,7 @@ Log in to OneSignal as the user identified by `externalId`, switching the user c
66
86
| ---------------- | ------------------- |
67
87
|**`externalId`**| <code>string</code> |
68
88
69
-
--------------------
70
-
89
+
---
71
90
72
91
### logout()
73
92
@@ -77,8 +96,7 @@ logout() => Promise<void>
77
96
78
97
Log out the current user. The SDK will reference a new device-scoped user.
79
98
80
-
--------------------
81
-
99
+
---
82
100
83
101
### setConsentRequired(...)
84
102
@@ -92,8 +110,7 @@ Set whether user privacy consent is required before sending data to OneSignal. C
92
110
| -------------- | -------------------- |
93
111
|**`required`**| <code>boolean</code> |
94
112
95
-
--------------------
96
-
113
+
---
97
114
98
115
### setConsentGiven(...)
99
116
@@ -107,12 +124,10 @@ Indicate whether the user has granted privacy consent.
107
124
| ------------- | -------------------- |
108
125
|**`granted`**| <code>boolean</code> |
109
126
110
-
--------------------
111
-
127
+
---
112
128
113
129
### Interfaces
114
130
115
-
116
131
#### OneSignalDebugAPI
117
132
118
133
Debug helpers exposed via `OneSignal.Debug`.
@@ -122,7 +137,6 @@ Debug helpers exposed via `OneSignal.Debug`.
122
137
|**setLogLevel**| (logLevel: <ahref="#loglevel">LogLevel</a>) => void | Set the log level printed to LogCat (Android) or the Xcode console (iOS). |
123
138
|**setAlertLevel**| (visualLogLevel: <ahref="#loglevel">LogLevel</a>) => void | Set the log level shown to the user as alert dialogs. |
124
139
125
-
126
140
#### OneSignalUserAPI
127
141
128
142
Current-user operations exposed via `OneSignal.User`.
@@ -153,22 +167,19 @@ Current-user operations exposed via `OneSignal.User`.
153
167
|**getExternalId**| () => Promise<string \| null>| Get the external ID set via `login`, or null if the user is anonymous. |
154
168
|**trackEvent**| (name: string, properties?: object \| undefined) => Promise<void>| Track a custom event with an optional set of JSON-serializable properties. |
Outcome reporting exposed via `OneSignal.Session`.
@@ -315,7 +312,6 @@ Outcome reporting exposed via `OneSignal.Session`.
315
312
|**addUniqueOutcome**| (name: string) => Promise<void>| <ahref="#record">Record</a> a unique outcome with the given name against the current session. |
316
313
|**addOutcomeWithValue**| (name: string, value: number) => Promise<void>| <ahref="#record">Record</a> an outcome with the given name and value against the current session. |
317
314
318
-
319
315
#### OneSignalLocationAPI
320
316
321
317
Location permission and sharing exposed via `OneSignal.Location`.
@@ -326,7 +322,6 @@ Location permission and sharing exposed via `OneSignal.Location`.
326
322
|**setShared**| (shared: boolean) => void | Enable or disable sharing the device location with OneSignal. |
327
323
|**isShared**| () => Promise<boolean>| Whether the device location is currently shared with OneSignal. |
328
324
329
-
330
325
#### OneSignalLiveActivitiesAPI
331
326
332
327
Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless noted.
@@ -340,56 +335,48 @@ Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless n
340
335
|**setupDefault**| (options?: <ahref="#liveactivitysetupoptions">LiveActivitySetupOptions</a> \| undefined) => Promise<void>| Set up the OneSignal default live activity, optionally enabling pushToStart/pushToUpdate. |
341
336
|**startDefault**| (activityId: string, attributes: <ahref="#record">Record</a><string, unknown>, content: <ahref="#record">Record</a><string, unknown>) => Promise<void>| Start a live activity backed by the OneSignal default attributes type. |
The setup options for `OneSignal.LiveActivities.setupDefault`.
392
379
393
-
<code>{ /*** When true, OneSignal will listen for pushToStart tokens for the `OneSignalLiveActivityAttributes` structure. */ enablePushToStart: boolean; /*** When true, OneSignal will listen for pushToUpdate tokens for each start live activity that uses the *`OneSignalLiveActivityAttributes` structure. */ enablePushToUpdate: boolean; }</code>
380
+
<code>{ /**_ When true, OneSignal will listen for pushToStart tokens for the `OneSignalLiveActivityAttributes` structure. _/ enablePushToStart: boolean; /**_ When true, OneSignal will listen for pushToUpdate tokens for each start live activity that uses the _`OneSignalLiveActivityAttributes` structure. \*/ enablePushToUpdate: boolean; }</code>
0 commit comments