NativeJS - OneSignal info

Get OneSignal push information

If your website defines a function called gonative_onesignal_info, it will get called after every page load as shown below. You may then POST it to your server via AJAX, or do anything else with it. More info here.
1
// you define this function, but do not actually call it!
2
// the app itself will call it after every page load of your app
3
function gonative_onesignal_info(info) {
4
console.log(info);
5
}
6
7
// info will look like
8
{
9
oneSignalUserId: 'xxxxxxx',
10
oneSignalPushToken: 'xxxxxx',
11
oneSignalSubscribed: true,
12
oneSignalRequiresUserPrivacyConsent: false,
13
platform: 'ios',
14
appId: 'io.gonative.example',
15
appVersion: '1.0.0',
16
distribution: 'release',
17
hardware: 'armv8',
18
installationId: 'xxxx-xxxx-xxxx-xxxx',
19
language: 'en',
20
model: 'iPhone',
21
os: 'iOS',
22
osVersion: '10.3',
23
timeZone: 'America/New_York'
24
}
Copied!
Last modified 1yr ago
Copy link