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
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,13 @@ Set `ONESIGNAL_DISABLE_LOCATION=true` in the environment before resolving or bui
40
40
ONESIGNAL_DISABLE_LOCATION=true npx cap sync
41
41
```
42
42
43
+
For day-to-day native builds and runs, keep the same environment variable set so Capacitor, Swift Package Manager, CocoaPods, and Gradle do not re-resolve with the location module included:
44
+
45
+
```bash
46
+
ONESIGNAL_DISABLE_LOCATION=true npx cap run ios
47
+
ONESIGNAL_DISABLE_LOCATION=true npx cap run android
48
+
```
49
+
43
50
In GitHub Actions, set it once at the job or step level so Swift Package Manager, CocoaPods, and Gradle builds inherit it:
This lightweight runnable example shows the native build flag for apps that use OneSignal push and in-app messaging, but do not use `OneSignal.Location`.
4
+
5
+
Run it with:
6
+
7
+
```sh
8
+
vp run ios
9
+
vp run android
10
+
```
11
+
12
+
## Setup
13
+
14
+
Copy `.env.example` to `.env` and set your OneSignal app ID:
15
+
16
+
```sh
17
+
cp .env.example .env
18
+
```
19
+
20
+
Then edit `.env`:
21
+
22
+
```sh
23
+
VITE_ONESIGNAL_APP_ID=your-onesignal-app-id
24
+
```
25
+
26
+
The `setup` script exports `ONESIGNAL_DISABLE_LOCATION=true` before packing the local plugin and running Capacitor sync, so Android Gradle and iOS Swift Package Manager resolve OneSignal without the location module.
27
+
28
+
## iOS
29
+
30
+
The `ios` script runs `setup`, which syncs Capacitor with:
31
+
32
+
```sh
33
+
ONESIGNAL_DISABLE_LOCATION=true
34
+
```
35
+
36
+
If you run `vpx cap sync ios`, Xcode, or Swift Package Manager manually, set `ONESIGNAL_DISABLE_LOCATION=true` in that environment too.
37
+
38
+
## Android
39
+
40
+
The `android` script runs `setup`, which syncs Capacitor with:
41
+
42
+
```sh
43
+
ONESIGNAL_DISABLE_LOCATION=true
44
+
```
45
+
46
+
If you build Android another way, such as Android Studio or a raw `./gradlew` invocation, set `ONESIGNAL_DISABLE_LOCATION=true` in that environment too.
47
+
48
+
## App Code
49
+
50
+
`src/App.tsx` initializes OneSignal and requests notification permission without calling the `OneSignal.Location` namespace during normal app flow. The optional location test button calls `OneSignal.Location.requestPermission()` to confirm the no-location bridge resolves safely.
0 commit comments