- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I have a problem with onesignal.
Just do not know what to index.html to receive notification.
onesignal this so >
in that part of APP that put the codes to receive a message?
I'm a beginner.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you know Javascript? The OneSignal Cordova plugin (or their RESTful API) are going to require quite a bit of Javascript skill to leverage in your app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am new to Javascript.
But it's just a test.
Do you want something to appear.
My app is simple, a screen with 1 text.
Hugs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Uriel,
the onsignal setup is quite straight forward.
Just check the Javascript examples.
1. Install the Javascript SDK (Google for Onesignal and XDK)
2. Create a simple xdk page with just on button in editor (btn_push)
3. insert the following Javascript into your js.file
4. Dont forget to prepare the Google ID and the Onesignal ID
Best,
Tom
(function () {
"use strict";
/*
hook up event handlers
*/
function register_event_handlers() {
// window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
var notificationOpenedCallback = function (jsonData) {
alert("Message was \n" + jsonData.message);
};
window.plugins.OneSignal.init("xxxxx-xxxxx-xxxxx-xxxxx-xxxxx", {
googleProjectNumber: "xxxxxxxxx"
},
notificationOpenedCallback);
// Show an alert box if a notification comes in when the user is in your app.
// window.plugins.OneSignal.enableInAppAlertNotification(true);
/* button #btn_push */
$(document).on("click", "#btn_push", function (evt) {
window.plugins.OneSignal.sendTag("Group", "My Testgroup");
// alert("Registered");
window.plugins.OneSignal.getIds(function (ids) {
alert("ID : "+ids.userId + "\nToken "+ ids.pushToken);
});
});
}
document.addEventListener("app.Ready", register_event_handlers, false);
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does not work. Please look at my code in the pastebin.
App.js > http://pastebin.com/RW67UCXH end index.html > http://pastebin.com/11CD0eKN
<!-- cordova-plugin-statusbar Yes --> | |
<!-- cordova-plugin-device Yes --> | |
<!-- cordova-plugin-splashscreen Yes --> | |
<!-- onesignal-cordova-plugin-pgb-compat Yes--> | |
<!-- com.google.playservices Yes --> | |
<!-- Minimum Android API 14 --> | |
<!-- Target Android API 19 --> |
Hugs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.
Very good
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page