GithubHelp home page GithubHelp logo

onesignal / onesignal-cordova-sdk Goto Github PK

View Code? Open in Web Editor NEW
251.0 54.0 197.0 3.69 MB

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com

License: Other

JavaScript 2.17% Java 26.36% Objective-C 17.95% TypeScript 48.35% HTML 0.52% Swift 3.08% Ruby 0.63% CSS 0.94%
push-notifications gcm fcm apns cordova phonegap ionic onesignal wns cordova-plugin

onesignal-cordova-sdk's Introduction

OneSignal Cordova Push Notification Plugin

npm version npm downloads


⚠️ Migration Advisory for current OneSignal customers

Our new user-centric APIs and v5.x.x SDKs offer an improved user and data management experience. However, they may not be at 1:1 feature parity with our previous versions yet.

If you are migrating an existing app, we suggest using iOS and Android’s Phased Rollout capabilities to ensure that there are no unexpected issues or edge cases. Here is the documentation for each:

If you run into any challenges or have concerns, please contact our support team at [email protected]


OneSignal is a free email, sms, push notification, and in-app message service for mobile apps. This plugin makes it easy to integrate your Cordova based (e.g. Ionic, PhoneGap, and PhoneGap Build app with OneSignal.

Cordova Notification

Installation and Setup

See the Documentation for installation and setup instructions:

API

See OneSignal's Client SDK Reference page for a list of all available methods.

Change Log

See this repository's release tags for a complete change log of every released version.

Support

Please visit this repository's Github issue tracker for feature requests and bug reports related specificly to the SDK. For account issues and support please contact OneSignal support from the OneSignal.com dashboard.

Demo Projects

To make things easier, we have published an Ionic Capacitor React demo app in the /example folder of this repository.

To test it out, run:

ionic capacitor run android

ionic capacitor run ios

Legacy (Player Model) demo projects:

Supports:

  • Cordova, Ionic, Ionic Capacitor, and Phonegap
  • Android 4.1 (API Level 16) through 12 (API Level 31), and Amazon FireOS
  • iOS 9 - 15

onesignal-cordova-sdk's People

Contributors

albertopq avatar alexp25 avatar brismithers avatar emawby avatar fintecheand0 avatar gdeglin avatar iuriikyian avatar janpio avatar jeasmine avatar jennantilla avatar jkalash avatar jkasten2 avatar jmadler avatar jongbonga avatar leemunroe avatar marclucraft avatar mikechoch avatar nan-li avatar nightsd01 avatar nunoarruda avatar osben avatar rgomezp avatar tanaynigam avatar wilgert avatar zaitsev1393 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

onesignal-cordova-sdk's Issues

Ionic-Cordova fails to find OneSignal plugin in the app

I am using cordova 6.0.0 and cordova-platform-android 6.0.0 for developing my ionic app.
I have added the one signal plugin in initialization scripts. The scripts looks like below.

sudo cordova platform add ios
sudo cordova platform add android
sudo ionic resources

sudo cordova plugin add onesignal-cordova-plugin
sudo cordova plugin add cordova-plugin-crosswalk-webview
sudo cordova plugin add ionic-plugin-keyboard
sudo cordova plugin add cordova-plugin-whitelist
sudo cordova plugin add cordova-plugin-console
sudo cordova plugin add cordova-plugin-splashscreen
sudo cordova plugin add cordova-plugin-network-information
sudo cordova plugin add cordova-plugin-screen-orientation
sudo cordova plugin add cordova-plugin-inappbrowser
sudo cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
sudo cordova plugin add cordova-plugin-vibration
sudo cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git

and in my ionic app in the app.js file I call the OneSignal init method as below.

ionic.Platform.ready(function () {
    app.run(function () {

        var notificationOpenedCallback = function(jsonData) {
            //console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
        };
       console.log('oneSignal plugin', window.cordova.plugins.OneSignal);
        window.cordova.plugins.OneSignal.init("my-one-signal-app-id",
            {googleProjectNumber: "my-google-app-id"},
            notificationOpenedCallback);

        window.cordova.plugins.OneSignal.enableInAppAlertNotification(true);


    });
});

But when I run the app it displays as below

oneSignal plugin undefined
app.js:29 Uncaught TypeError: Cannot read property 'init' of undefined

Is it an issue with cordova 6.0.0?

Receiving notifications on iOS when app immediately in background

I am unclear if this should be asked here or on the OneSignal website. I have asked on both to be sure. Apologies if I have this wrong and its for the website help team (or vice versa).

I have a question regarding how the OneSignal notification handler responds when the IOS app has moved to background (IOS has not suspended the app yet) AND a content-available =1 notification is sent.

As the IOSapp has been in the the background for only a few minutes (or secs), I would expect the OneSIgnal handler to process the notification (which is simply to log it at the moment). Currently the handler works in foreground but not at all when the app is in the background.

Is this the expected behaviour? Experience with other notification plugins is they keep on working until the IOS app gets suspended which is some variable time that the device determines but can be up to 15 mins or so.

This is with IOS 9.2 and Xcode 7.2, onesignal-cordova-plugin 1.10.1.

Thanks,

Rob

Backend user deletion - getIds using cached value

Hi,

I'm seeing an odd issue when deleting a user from the backend.

I've registered a user via a cordova app on android. Then i delete the user from the backend UI. When i restart my app and init is called again, a new user is created as I can see in the backend UI. However, when I call getIds after init, I get the userId of the deleted user. After another restart and init, I get the new userId of the new user.

in steps:

  1. App starts and calls init method
  2. onesignal backend creates a user with id 1234
  3. i call getIds in the app, userId is 1234
  4. I delete the user from the backend UI
  5. I restart the app, init gets called again
  6. onesignal creates a new user with id 5678
  7. I call getIds, i get 1234 as userId which is the deleted userId
  8. I do another restart, init runs and now getIds returns 5678 as userId

So the deleted ID is only returned the first run of init after I deleted the user.

The issue does not occur when I replace step 4 above with a complete reinstall of the app on the device. Maybe the Android SDK caches the userId or something?

let me know if you need more information.

Kind regards,
Jaap-Jan

The method removeNotificationOpenedHandler() is undefined for the type OneSignal

Hello,

I tried to run a Cordova app with OneSignal plugin, but it fails with the following error at void com.plugin.gcm.OneSignalPush.onDestroy():287:
The method removeNotificationOpenedHandler() is undefined for the type OneSignal

I checked it on Eclipse and Android Studio - and the error exists on the both platforms.

The version of OneSignal is:
onesignal-cordova-plugin 1.11.2 "OneSignal Push Notifications"

Also when I comment out the 287 line of code - it works:
@Override public void onDestroy() { // OneSignal.removeNotificationOpenedHandler(); }

BTW I tried with older version of the plugin (1.10.1) and it works.

Callbacks feature request

Hi!

It would be great if functions like sendTag, sendTags, setSubscription, etc would enable the use of success and error callbacks. This would help to determine if these operations succeed or fail, to be able to act correctly on any errors.

I'm guessing this is not specific to the Cordova SDK as other SDK's also don't seem to provide callbacks for these kind of operations.

kind regards,
Jaap-Jan

iOS 9 Simulator Not Subscribing

screen shot 2015-10-25 at 2 07 46 pm

Might be something easy to fix, or I might be doing something wrong here. I get the popup asking to allow notifications and I pressed yes. I also double checked with everything in the device settings.

Here's my code:

    this.init = function () {
        self.opts = {
            autoRegister: true
        }

        if ( device.platform == 'Android' ) {
            self.opts.googleProjectNumber = "133713371337"
        }

        // console.log( self.opts )

        window.plugins.OneSignal.init( "1337-1337-1337-1337-1337", self.opts, function ( data ) {
            // console.info( "HOMIES GET SOME DATA" )
            console.log( data )
        } )

        window.plugins.OneSignal.getIds( function ( ids ) {
            // console.log( JSON.stringify( ids, true, 4 ) )
            $rootScope.data.user.oneSigID = ids.userId
            $store.set( "data.user.oneSigID", $rootScope.data.user.oneSigID )
            $store.set( "data.user.oneSigID.pushToken", ids.pushToken )
        } )

        window.plugins.OneSignal.enableInAppAlertNotification( false )
        window.plugins.OneSignal.enableNotificationsWhenActive( false )
        window.plugins.OneSignal.setSubscription( true )
    }

And my info:

Cordova CLI: 5.3.3
Gulp version:  CLI version 3.9.0
Ionic CLI Version: 1.7.7
Ionic App Lib Version: 0.6.3
ios-deploy version: 1.8.2 
ios-sim version: 5.0.3 
OS: Mac OS X Yosemite
Node Version: v4.2.1
Xcode version: Xcode 7.0 Build version 7A220

And the log:

Oct 25 14:04:13 Robs-Mac-Pro mstreamd[4565]: (Note ) PS: The subscription plugin class does not support push notification refreshing.
Oct 25 14:04:14 Robs-Mac-Pro SpringBoard[4576]: +[UNNotificationStore migratePushStore] Migrating push store: /Users/roblav96/Library/Developer/CoreSimulator/Devices/7053ACBC-607B-4E2E-9F0D-1FCC0C272933/data/Library/SpringBoard/PushStore
Oct 25 14:04:16 Robs-Mac-Pro bird[4628]: Unable to bootstrap_check_in() to namedDelegatePort 'com.apple.bird.push'. APS connections will not persist past process lifetime.
Oct 25 14:04:17 Robs-Mac-Pro client[4632]: ERROR: Error registering for Apple push notifications. Error: Error Domain=NSCocoaErrorDomain Code=3010 "REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION" UserInfo={NSLocalizedDescription=REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION}
Oct 25 14:05:46 Robs-Mac-Pro mstreamd[4705]: (Note ) PS: The subscription plugin class does not support push notification refreshing.
Oct 25 14:05:47 Robs-Mac-Pro SpringBoard[4716]: +[UNNotificationStore migratePushStore] Migrating push store: /Users/roblav96/Library/Developer/CoreSimulator/Devices/7053ACBC-607B-4E2E-9F0D-1FCC0C272933/data/Library/SpringBoard/PushStore
Oct 25 14:05:50 Robs-Mac-Pro client[4761]: ERROR: Error registering for Apple push notifications. Error: Error Domain=NSCocoaErrorDomain Code=3010 "REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION" UserInfo={NSLocalizedDescription=REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION}

I'm hoping to get my hands on an actual device for testing by next week. I'll update if anything comes up. Thank you!

notificationOpenedCallback called again after pause

Hello all together,

I have encountered a strange problem, that occurs only, if I need to launch an external web browser (not the internal one).
Doing so, ALTHOUGH the callback is finished for sure, at least in javascript, sends the app to the background (sofar so god). I did this to open the app store (to explain, why).
After returning to the app, the callback function is called with the exact same message data again, so my messge box is displayed again.

Obviously this callback should be called only once

Plugin not loading on Phonegap Build

I have added the plugin to my config.xml

<gap:plugin name="onesignal-cordova-plugin-pgb-compat" source="npm" />
<gap:plugin name="cordova-plugin-googleplayservices" source="npm" />
<gap:plugin name="cordova-plugin-android-support-v4" source="npm" />

Whenever I call the plugin code (window.plugins.OneSignal.init(...)) from the deviceready callback I get Uncaught TypeError: Cannot read property 'OneSignal' of undefined

I can see the onesignal source in the apk but not for "cordova-plugin-googleplayservices" or "cordova-plugin-android-support-v4"

Android-support-v4.jar mismatch with facebookConnect

The moment I've added the OneSignal plugin, the build for Android failed with the following error:

[dependency] Found 2 versions of android-support-v4.jar in the dependency list,
[dependency] but not all the versions are identical (check is based on SHA-1 only at this time).
[dependency] All versions of the libraries must be the same at this time.
[dependency] Versions found are:
[dependency] Path: /project/com.phonegap.plugins.facebookconnect/cyberdunk-FacebookLib/libs/android-support-v4.jar
[dependency]    Length: 758727
[dependency]    SHA-1: efec67655f6db90757faa37201efcee2a9ec3507
[dependency] Path: /project/libs/android-support-v4.jar
[dependency]    Length: 987314
[dependency]    SHA-1: 9b6a9a9078af571732159b904ad423b03b7cc786

BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:573: Jar mismatch! Fix your dependencies

It seems the facebookConnect plugin and this one are using different android libraries.

Is there a known fix ? Any 2 versions of the two plugins are compatible ? Any thoughts ? It seems to build on iOS.

Thank you

Android App Badge number Support

Is it possible to know when a notification arrives and fire some event? Even when the user does not open the notification? I use Phonegap Build I will really appreciate if there is some way to do that without having to develop in Java. Thanks

Intel XDK - IOS - Incompatibility due to old Xcode version being used

Intel XDK's build server is using a version of Xcode that is older than 6.2 which causes a build error with UILocalNotification.alertTitle. I believe this is the only API that is used that requires Xcode 6.2 so this can be called via reflection to lower the required Xcode version.

Notifications not received when app is closed (Android)

I've upgraded today from ver. 1.5 and things are not working as expected.
With ver. 1.5 I can receive notifications when my app is running (through didReceiveRemoteNotificationCallBack) and in the notification drawer when the app is closed.

After the upgrade to ver. 1.6 things are not working anymore.
I can only receive notifications when my app is running and now the notifications are show in the drawer (good thing).

Disable notifications

Hi, is it possible to make available a method to disable the push notifications? I would like to give to my users a settings to enable/disable it.

[Unity] When I close my app from the task bar, no notifications are being received.

Hi,

I know this issue is already up there (but then for Cordova) but this is also more of a question.
I know that people said that you can't receive notifications when forcing the app to close (as in: moving it out of your task bar)

I don't get this, because how do other apps do it then? (like Whatsapp) which I also clearly close from my taskbar from time to time.

Is there a way to make sure the Unity SDK can do the same thing? A game is quite a big of a memory eating app and I can imagine users not wanting it to stay open just to receive a possible notification.

Thanks!

Edit: oops wrong repository! Moved it over here: OneSignal/OneSignal-Unity-SDK#4

Windows Phone support and Notification TTL

2 improvements for this service:

  • Windows Phone support
  • Expiration time; Set the period after which the push won't be delivered if the device was offline.

Keep up the good work!

Phonegap Build Release

com.onesignal.plugins.onesignal pgb 1.9.0 1.9.0 android,ios
image

After building the app, I can see I get only 1.9.0 release only.
Also It doesn't get added for WIN support

Can you please assist if anything special is required for handling the same.

IOS Background Notifications

When I create a message on the site and the app is not open ( not even in the background ) I receive the push. The message created from the site has the content_availble set to false.

When I create a message from my own server and the app is open or in the background, everything works as expected, but when the app is closed, the notification does not show up.

I have tried

  • "content_available": 1
  • "content_available": true
  • not putting in the content_available parameter.

My full payload looks like

{
"app_id": "...",
"contents": { "en": "..."},
"include_player_ids":["..."],
"ios_sound": "yak.wav",
"android_sound": "yak.wav",
"ios_badgeType": "SetTo",
"ios_badgeCount": Number(badgeCount),
"buttons": [ {"id": "view", "text": "View", "icon": "ic_menu_share"} ],
"data": { "path": path},
//"content_available": 1,
//"_background_data":true,
}

My plugins are
com-badrit-base64 0.2.0 "Base64"
com.cmackay.plugins.googleanalytics 0.1.22 "GoogleAnalytics"
com.phonegap.plugins.PushPlugin 2.5.0 "PushPlugin"
cordova-plugin-actionsheet 2.2.2 "ActionSheet"
cordova-plugin-app-event 1.2.0 "Application Events"
cordova-plugin-badge 0.7.2 "Badges"
cordova-plugin-camera 2.2.0 "Camera"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.3 "Console"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-facebook4 1.7.0 "Facebook Connect"
cordova-plugin-file 4.2.0 "File"
cordova-plugin-file-transfer 1.5.1 "File Transfer"
cordova-plugin-geolocation 2.2.0 "Geolocation"
cordova-plugin-inappbrowser 1.4.0 "InAppBrowser"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
cordova-plugin-x-socialsharing 5.0.12 "SocialSharing"
de.appplant.cordova.plugin.badge 0.7.1 "Cordova Badge Plugin"
ionic-plugin-deploy 0.5.0 "IonicDeploy"
ionic-plugin-keyboard 2.0.1 "Keyboard"
onesignal-cordova-plugin 1.12.3 "OneSignal Push Notifications"
org.transistorsoft.cordova.background-notification 0.1.0 "CDVBackgroundNotification"
phonegap-plugin-push 1.6.2 "PushPlugin"

I'm using ionic 1.7.14 and xcode 7.3 with a deploy target of 8.0

any guidance would be appreciated! Thanks!

cordova build ios failed

Hi,
I am trying to install one signal into my app and failed into iOS platform, all is perfect in Android one.

I got the following error:
com.onesignal.plugins.onesignal/OneSignal.m:1045:30: error:
property 'alertTitle' not found on object of type 'UILocalNotification *'
notification.alertTitle = data[@"m"][@"title"];

And after that the command told me that the build is failed

Thanks!

Update badge icon only

My client asked me if it's possible to update the badge icon of an app without the regular pushnotification action (message at the top of the screen + screen on). Is this possible? And does Android support badge icons?

Could not find com.android.support:support-v4:23.0.0.

Error while building android app

Could not resolve all dependencies for configuration ':_debugCompile'.
Could not find com.android.support:support-v4:23.0.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/23.0.0/support-v4-23.0.0.pom
https://repo1.maven.org/maven2/com/android/support/support-v4/23.0.0/support-v4-23.0.0.aar
file:/C:/Program Files/Android/android-sdk/extras/android/m2repository/com/android/support/support-v4/23.0.0/support-v4-23.0.0.pom
file:/C:/Program Files/Android/android-sdk/extras/android/m2repository/com/android/support/support-v4/23.0.0/support-v4-23.0.0.aar
file:/C:/Program Files/Android/android-sdk/extras/google/m2repository/com/android/support/support-v4/23.0.0/support-v4-23.0.0.pom
file:/C:/Program Files/Android/android-sdk/extras/google/m2repository/com/android/support/support-v4/23.0.0/support-v4-23.0.0.aar
Required by:
:android:unspecified > com.google.android.gms:play-services-gcm:8.4.0 > com.google.android.gms:play-services-base:8.4.0 > com.google.android.gms:play-services-basement:8.4.0

Local Notification + OneSignal - PGB Fails

Android SDK API: 22
Cordova CLI: 5.3.3

OneSignal plugins:
<gap:plugin name="onesignal-cordova-plugin-pgb-compat" source="npm" />
<gap:plugin name="cordova-plugin-googleplayservices" source="npm" />
<gap:plugin name="cordova-plugin-android-support-v4" source="npm" />

Local Notification plugins:
<gap:plugin name="de.appplant.cordova.plugin.local-notification" />
1

And updating the Local Notification plugin from NPM sources results -
<gap:plugin name="cordova-plugin-local-notifications" source="npm" />

gives output as -
local-notification

Looking for the support.

How to disable creating notifications completely?

For security purposes, I don't want the cordova client to be able to create notifications. I only create them on my backend using the REST API. How can I achieve this?

I might be overthinking it, because the user would need the other users id, but just in case :D

Double push

I'm using the following code:

    didReceiveRemoteNotificationCallBack : function(jsonData) {
        //set redirect
        if(jsonData.additionalData.page) {
            redirect=jsonData.additionalData.page;
            title=jsonData.additionalData.title;
            label1=jsonData.additionalData.label1;
            label2=jsonData.additionalData.label2;

            //slug
            slug=getParameter('slug', redirect);
        }

        check();

        if(jsonData.isActive===true) {
            if(redirect && label1 && label2) {
                navigator.notification.confirm(
                    jsonData.message,
                    function(button) {
                        if(button==1) {
                            $.mobile.changePage(redirect, { transition: 'slide' });
                        }
                    },
                    title,
                    [label1,label2]
                );
            }else navigator.notification.alert(jsonData.message, nothing, 'Pannenkoekenhuizen', 'Sluiten');
        }else $.mobile.changePage(redirect, { transition: 'slide' });
    }

When sending a push message and clicking on it from the notifications bar the apps opens, redirect, so that works perfectly. When going to another page within the app, the action after "if(jsonData.isActive===true) {" is triggered so the message is shown twice.

jsonData.isActive is used when the app is on foreground when receiving the message right?

I'm I doing something wrong?

postNotification - Can create WebThreadLock errors

OneSignal.postNotification can sometimes create WebThreadLock errors if a callbacks are defined for this function call. The Objective-C code may need to ensure that the callback is firing on the main thread to fix the issue.

As a workaround your app can make a call to the the OneSignal create notification REST API POST call directly. Make sure not to include your App REST API key for security. This means you can only target users with include_player_ids just like the postNotificaiton function. If you need to use other targeting parameters like included_segments or tags which require this you will need to make the REST API call from your server.

Android - Background APP - Notification Callback

Here are the observations -

  1. When app is in background (via back button) - notification callback desn't work/even no updates on notification tray
  2. When app is in background (via home button) - notification callback doesn't support, rather it brings notifications on notification tray

Can we have some provision for consistent behavior.

Can we have some idea to sync all requests without opening the item from tray, as after click this gets I can write some callback, I would like to get all incoming envelopes into localstorage, so that whether user opens/dismiss the item the logic should be consistent.

Turn off alert box

I want to turn off the alert box that shows up when a user gets a push notification while active in the app.
I have the following in my "deviceready" event handler:

window.plugins.OneSignal.enableInAppAlertNotification(false);
window.plugins.OneSignal.enableNotificationsWhenActive(false);

I have tried to do a clean build and it that has no effect.

notificationOpenedCallback not being called on First Run of the app after Install

We Created an Apk file to install on Device, Installed and Device Registered with OneSignal perfectly, starts recieving pushes. Now in the Push we sent some additonal Data, but when we hit the push notification and it takes us to App, but "notificationOpenedCallback" is not called up....

But then we tried something, We closed the app and reopened it, Resent the Push with Additional Data, and now the "notificationOpenedCallback" worked without any issues

We are using Ionic Framework and Cordova.

Plugin "onesignal-cordova-plugin" is not present in the project

I've added the plugin as suggested in the docs.
and I have the plugin installed in my folder.

When I try to remove it I get this weird message:

E:\TEMP\Ionic\pusheroo>cordova plugin rm onesignal-cordova-plugin --save
Plugin "onesignal-cordova-plugin" is not present in the project. Converting value to "com.onesignal.plugins.onesignal" and trying again.
Uninstalling com.onesignal.plugins.onesignal from android
Removing "com.onesignal.plugins.onesignal"
config.xml entry for com.onesignal.plugins.onesignal is removed

The plugin gets removed at the end.

Notifications not received when app is closed

I would like to send push notifications to my Android app even if the user didn't open the app. I only can receive notifications if app is opened, or running in background. If I kill it using the Task Manager, I can't receive any messages.

Thanks

Google service dependencies version

Today you are adding deps in gradle with the "+" version.
This create a problem supporting with cordova and the default google service sdk.
Adding classpath 'com.google.gms:google-services:+' does not help.

notificationOpenedCallback App in background

Hello.

When app is in background (via home button) and a notification is received the notificationOpenedCallback is triggered as expected.

But when app is in background via back button, the notification is received, appears at the notification area, but when tapped the notificationOpenedCallback is not triggered.

GetIds Method on Windows Phone

I'm running an software on Windows Phone 8.1.
At some point, I've tried to get my OneSignal ID with GetIDs Method.
But, this method does not fire any callbacks , on Windows Phone 8.1.

Maybe is the "idsavailableevent" event isn't firing.
` getIds: function (successCallback, errorCallback, params) {
OneSignal_JSBridge.addEventListener("idsavailableevent", function (e) {
successCallback({ userId: e.userId, pushToken: e.pushToken });
});

  OneSignal_JSBridge.getids();

},`

I tried to explore on this one but... I don't even know how to open Windows native files on the plugin. (x
Hope you could help me on this one.

Building problem on Windows 8.1

After adding the oneSignal plugin to the windows version of the app and trying to run the app:

cordova plugin add onesignal-cordova-plugin
cordova run windows

I'm getting the following error:

C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(181,5):
error : Couldn't find the required information in the lock file. Make sure you
have .NETCore,Version=v5.0/win10-anycpu mentioned in your targets. [D:\xampp\ht
docs\**\platforms\windows\CordovaApp.Windows10.jsproj]

ERROR: Error code 1 for command: C:\Program Files (x86)\MSBuild\14.0\bin\amd64\msbuild with args: D:\xampp\htdocs\**\platforms\windows\CordovaApp.Windows10.jsproj,/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal,/nologo,/p:Configuration=debug,/p:Platform=anycpu
ERROR running one or more of the platforms: Error: cmd: Command failed with exit code 2
You may not have the required environment or OS to run this project

Line 181 seems to be:

<ResolveNuGetPackageAssets Condition="Exists('$(FrameworkInjectionLockFile)')"
                               NuGetPackagesDirectory="$(FrameworkInjectionPackagesDirectory)"
                               RuntimeIdentifier="$(NuGetRuntimeIdentifier)"
                               TargetMonikers="$(NuGetTargetMonikerToInject)"
                               ProjectLockFile="$(FrameworkInjectionLockFile)">
<Output TaskParameter="ResolvedCopyLocalItems" ItemName="_InjectNetCoreFrameworkPayload" />
    </ResolveNuGetPackageAssets>

It works if I remove the plugin.
Any thoughts ?

P.S.
I'm using Windows 10 as operating system, cordova version 5.3.3 and Visual Studio Community 2015.

more than one library with package name 'com.google.android.gms'

Error on android build. The problem is when use the plugin with other plugin for Google Analytics that use Google Play Services also.

I tried wiht the two most popular plugins for Analytics with the same confilct:

https://github.com/cmackay/google-analytics-plugin
https://github.com/danwilson/google-analytics-plugin

How you can replicate the problem:

cordova create myapp com.yourname.myapp MyApp
cd myapp
cordova platform add android
cordova plugin add cordova-plugin-google-analytics
cordova plugin add onesignal-cordova-plugin
cordova build --debug android

FAILURE: Build failed with an exception.

I couldn't update my oneSignal plugin cause of a build failure so I decided to create a fresh new project using ionic.
This is the error I get:

onesignal

Using the Android 5.1.1 (API 22)

Installed Google Play Services
Installed Google Repository
Installed Android Support Repository
Installed Android Support Library

Cordova CLI: 5.2.0
OS: Windows 7 SP1
Node Version: v0.12.7
Android Engine: 4.1.1

OneSignal.init() with autoregister false does not delay native push prompt

@roblav96 @jkasten2
Even though i am passing autoRegister: false to .init() function native prompt still comes before my popup (not after user clicks ok).
Here is my code:

// Push notifications
      var notificationOpenedCallback = function (jsonData) {
        console.log("didReceiveRemoteNotificationCallBack: " +
        JSON.stringify(jsonData));
      };

      if (window.plugins && window.plugins.OneSignal) {
        console.log('*** initializing OneSignal...');
        window.plugins.OneSignal.init(
          CONFIG.ONESIGNAL_APP_ID, {
            googleProjectNumber: CONFIG.GOOGLE_PROJECT_NUMBER,
            autoRegister: false
          },
          notificationOpenedCallback
        );

        $ionicPopup.confirm({
          title: "&nbsp;",
          template: CONSTANTS.MSG_REGISTER_FOR_PUSH_NOTIFICATIONS
        }).then(function (res) {
          if (res) {
            console.log('*** prompting user to recieve push notificaitons...');

            window.plugins.OneSignal.registerForPushNotifications();
            // Show an alert box if a notification comes in when the user is in your app.
            window.plugins.OneSignal.enableInAppAlertNotification(true);
          }
        });

Any pointers what i am doing wrong here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.