Coder Social home page Coder Social logo

roblav96 / nativescript-onesignal Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 42.0 8.32 MB

A Nativescript plugin that wraps the iOS and Android OneSignal Push Notifications SDK.

Home Page: https://documentation.onesignal.com/docs/getting-started

License: Other

TypeScript 9.67% Ruby 0.72% JavaScript 89.61%

nativescript-onesignal's Introduction

NativeScript-OneSignal

A Nativescript plugin that wraps the iOS and Android OneSignal Push Notifications SDK.

Contributors

OneSignal-iOS-SDK

OneSignal-Android-SDK

Supported Platforms

  • iOS
  • Android

Installation

tns plugin add nativescript-onesignal

iOS

Does not need any configuration.

Android

Does not need any configuration.

Usage

Typescript

var TnsOneSignal = require('nativescript-onesignal').TnsOneSignal

iOS

TnsOneSignal is the native iOS OneSignal class.

In your main.ts:

import * as application from 'application';
var TnsOneSignal = require('nativescript-onesignal').TnsOneSignal

if (application.ios) {
	class MyDelegate extends UIResponder implements UIApplicationDelegate {

		public static ObjCProtocols = [UIApplicationDelegate]

		private applicationDidFinishLaunchingWithOptions(app: UIApplication, launchOptions: NSDictionary): boolean {

			try {

				console.dump('TnsOneSignal', TnsOneSignal)
				TnsOneSignal.initWithLaunchOptionsAppId(launchOptions, 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba')

			} catch (error) {
				console.error('error', error)
			}

			return true
		}

	}
	application.ios.delegate = MyDelegate
}

Android

TnsOneSignal is the native Android com.onesignal.OneSignal class.

In your main.ts:

import * as application from 'application';
var TnsOneSignal = require('nativescript-onesignal').TnsOneSignal

if (application.android) {
	application.on(application.launchEvent, function(args: application.ApplicationEventData) {

		try {

			console.dump('TnsOneSignal', TnsOneSignal)
			TnsOneSignal.startInit(application.android.context).init()

		} catch (error) {
			console.error('error', error)
		}

	})
}

API Reference

iOS API Reference

Android API Reference

Typescript Typings

iOS

Android - In the works...

Demo

npm run setup
# iOS
npm run demo.ios
# Android
npm run demo.android

nativescript-onesignal's People

Contributors

ericky14 avatar jkasten2 avatar roblav96 avatar robophil 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nativescript-onesignal's Issues

1.0.6 crashes app

When updating to 1.0.6, I get this error after the app builds:

***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x1006d5dc0 -[TNSRuntime executeModule:referredBy:]
2 0x1000d9428 main
3 0x191d315b8
JavaScript stack trace:
1 @file:///app/tns_modules/nativescript-onesignal/onesignal.js:2:33
JavaScript error:
file:///app/tns_modules/nativescript-onesignal/onesignal.js:2:33: JS ERROR ReferenceError: Metadata for "OneSignal.OneSignal" found but symbol not available at runtime.

I had to downgrade back to 1.0.5, in which case it works fine.

NotificationExtenderService [HELP]

I want my application to have been killed. Receive push notifications, I have tried to implement NotificationExtenderService, as follows without success:

En mi androidManifest.xml:
add service com.onesignal.meNotificationExtender or .meNotificationExtender

<service
		   android:name="com.onesignal.meNotificationExtender"
		   android:permission="android.permission.BIND_JOB_SERVICE"
		   android:exported="false">
		   <intent-filter>
		      <action android:name="com.onesignal.NotificationExtender" />
		   </intent-filter>
		</service> 

On me onesignal.android.js
"use strict";
exports.TnsOneSignal = com.onesignal.OneSignal;
exports.TnsNotificationExtenderService = com.onesignal.NotificationExtenderService;

On me main.ts in app nativescript + angular:

var OneSignal: any = require('nativescript-onesignal').TnsOneSignal;
var NotificationExtenderService: any = require('nativescript-onesignal').TnsNotificationExtenderService;

...
class meNotificationExtender extends NotificationExtenderService {
     private onNotificationProcessing(receivedResult) {
         // Read properties from result.
         setBoolean('demo', true);
         // Return true to stop the notification from displaying.
         return true;
     }
 }

any idea ?

Firebase Facebook login and OneSignal plugin conflict delegate

Hi,
I have a problem.
My code:

if (application.ios) {
            class IosDelegate extends UIResponder implements UIApplicationDelegate, CLLocationManagerDelegate {
                public static ObjCProtocols = [UIApplicationDelegate];
                applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<any, any>): boolean {
                    try { OneSignalIos.launch(application, launchOptions); } catch (err) {}
                    return false;
                }
            }
            application.ios.delegate = IosDelegate;
        }

If I want to use Firebase facebook login not working. If I remove
application.ios.delegate = IosDelegate;
works fine. Can U help me what is the problem?
Thanx
Miklos

nativescript 3.4.0 update and problem

Can U help me?

ERROR in OneSignal.android.d.ts(3,52): error TS2339: Property 'amazon' does not exist on type 'typeof com'.
OneSignal.android.d.ts(14,47): error TS2339: Property 'amazon' does not exist on type 'typeof com'.
OneSignal.android.d.ts(15,44): error TS2314: Generic type 'Class' requires 1 type argument(s).
OneSignal.android.d.ts(123,72): error TS2339: Property 'WakefulBroadcastReceiver' does not exist on type 'typeof content'.
OneSignal.android.d.ts(146,78): error TS2339: Property 'WakefulBroadcastReceiver' does not exist on type 'typeof content'.
OneSignal.android.d.ts(175,44): error TS2694: Namespace 'com' has no exported member 'google'.
OneSignal.android.d.ts(177,40): error TS2694: Namespace 'com' has no exported member 'google'.
OneSignal.android.d.ts(188,90): error TS2694: Namespace 'com' has no exported member 'google'.
OneSignal.android.d.ts(188,161): error TS2694: Namespace 'com' has no exported member 'google'.
OneSignal.android.d.ts(189,55): error TS2694: Namespace 'com' has no exported member 'google'.
OneSignal.android.d.ts(226,76): error TS2694: Namespace 'android.support.v4.app.NotificationCompat' has no exported member 'Extender'.
OneSignal.android.d.ts(256,59): error TS2694: Namespace 'android.view' has no exported member 'SearchEvent'.
OneSignal.android.d.ts(260,55): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(264,75): error TS2694: Namespace 'android.os' has no exported member 'PersistableBundle'.
OneSignal.android.d.ts(327,42): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(333,46): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(338,47): error TS2314: Generic type 'Class' requires 1 type argument(s).
OneSignal.android.d.ts(338,81): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(353,45): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(358,47): error TS2314: Generic type 'Class' requires 1 type argument(s).
OneSignal.android.d.ts(358,81): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(402,35): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(475,46): error TS2314: Generic type 'Collection' requires 1 type argument(s).
OneSignal.android.d.ts(509,44): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(518,47): error TS2314: Generic type 'Class' requires 1 type argument(s).
OneSignal.android.d.ts(518,81): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(539,57): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(545,47): error TS2314: Generic type 'Class' requires 1 type argument(s).
OneSignal.android.d.ts(545,81): error TS2314: Generic type 'Enum' requires 1 type argument(s).
OneSignal.android.d.ts(653,59): error TS2694: Namespace 'android.view' has no exported member 'SearchEvent'.
OneSignal.android.d.ts(658,55): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(662,75): error TS2694: Namespace 'android.os' has no exported member 'PersistableBundle'.
OneSignal.android.d.ts(750,58): error TS2694: Namespace 'com' has no exported member 'amazon'.
OneSignal.android.d.ts(751,55): error TS2694: Namespace 'com' has no exported member 'amazon'.
OneSignal.android.d.ts(752,62): error TS2694: Namespace 'com' has no exported member 'amazon'.
OneSignal.android.d.ts(753,55): error TS2694: Namespace 'com' has no exported member 'amazon'.
OneSignal.android.d.ts(754,51): error TS2694: Namespace 'com' has no exported member 'amazon'.
OneSignal.android.d.ts(769,73): error TS2339: Property 'WakefulBroadcastReceiver' does not exist on type 'typeof content'.
OneSignal.android.d.ts(781,47): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(827,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(845,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(859,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(873,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(887,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(901,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(921,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(935,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(949,51): error TS2314: Generic type 'List' requires 1 type argument(s).
OneSignal.android.d.ts(963,51): error TS2314: Generic type 'List' requires 1 type argument(s).

Please, can someone help changing TS code to JS for NS Core ?

I'm trying to implement the main.ts code into my NS Core JS app to support IOS and Android. I was able to easily change the Android code to JS but IOS one is more challenging, can someone help me switch it to JS please ?

This is the code in the Library TS example:

MAIN.TS (For IOS)

import * as application from 'application';
var TnsOneSignal = require('nativescript-onesignal').TnsOneSignal

if (application.ios) {
    class MyDelegate extends UIResponder implements UIApplicationDelegate {
        public static ObjCProtocols = [UIApplicationDelegate]
        private applicationDidFinishLaunchingWithOptions(app: UIApplication, launchOptions: NSDictionary): boolean {
            try {
                console.dump('TnsOneSignal', TnsOneSignal)
                TnsOneSignal.initWithLaunchOptionsAppId(launchOptions, 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba')
            } catch (error) {
                console.error('error', error)
            }
            return true
        }
    }
    application.ios.delegate = MyDelegate
}

I think it could be nice to include JS in the docs for futher references, right ?

Also, here's my JS converted for ANDROID, if someone can check it too just in case.... but so far it works.

APP.JS (For ANDROID - Modified)

var TnsOneSignal = require("nativescript-onesignal").TnsOneSignal;

if (application.android) {
    application.on(application.launchEvent, function(args) {
        try {
            console.log('TnsOneSignal', TnsOneSignal);
            TnsOneSignal.startInit(application.android.context).init();
        } catch (error) {
            console.log('error', error);
        }
    })
}

Ios Android inconsistency

Hi Just to let you know that there is a platform inconsistency :
sendTag method on Android is not a method on Ios ...
Official Api uses sendTag

if(isIOS)
                {
                    TnsOneSignal.sendTagValue("userid",this.userModel.id+"");
                    TnsOneSignal.sendTagValue("driver",this.userModel.driver+"");
                }
            else if(isAndroid)
                {
                    TnsOneSignal.sendTag("userid",this.userModel.id+"");
                    TnsOneSignal.sendTag("driver",this.userModel.driver+"");
                }

Expose OneSignal Api for asking notification permission

I want to manually ask the user if he/she accepts push notifications after he/she successfully logged in.

This is a sample code snippet from ios sdk for manually asking the user to accept or deny push notification from onesignal. Anyone knows how to implement it using the NS-onesignal plugin?

OneSignal.promptForPushNotifications(userResponse: { accepted in
      print("User accepted notifications: \(accepted)")
})

How to set setInFocusDisplaying to false

Hi, I'm trying to disable alert notifications inside the app when active.
I searched for a solution and found this options in OneSignal native SDK
but when I tried to use it it says:

TnsOneSignal.startInit(...).setNotificationOpenedHandler(...).setInFocusDisplaying is not a function

How can I do this ?
Thanks

[Request] Wrapper needed

Hi @roblav96
Would you like to help us with a wrapper for OneSignal SDKs ?
It would be very useful and easy to understand how to use this plugin in my application and I think it will be useful for others as well.

Thanks 👍

alert dialog when receiving pushes

Is there some default functionality when receiving push notifications that cause an alert dialog to pop up?

I have my received and open handlers set and they do not include an alert() yet I am still getting an alert dialog.

Someone is using Nativescript Angular version and webpack?

Hi!
Someone is using Onesignal plugin Nativescript Angular version and webpack?
I make tns run android and tns run ios is fine. Typescript not get error and plugin work great but if I use webpack build the plugin not working.
I must insert this code in main.aot.ts?
Why not working plugin when webpack successed build project?
Please help someone because I use lot of hours google but I don't find my problem.

I use this code in main.ts:
const TnsOneSignal = require('nativescript-onesignal').TnsOneSignal;

if ( application.ios ) {
    class MyDelegate extends UIResponder implements UIApplicationDelegate {
        public static ObjCProtocols = [UIApplicationDelegate];
        applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<any, any>): boolean {
            try {
                console.log('TnsOneSignal', TnsOneSignal);
                TnsOneSignal.initWithLaunchOptionsAppId(launchOptions, 'xxxxxx-xxxx-xxxx-xxxx');
            } catch (error) {
                console.error('error', error);
            }
            return true;
        }
        applicationDidBecomeActive(application: UIApplication): void {
            console.log("applicationDidBecomeActive: " + application);
        }
    }
    application.ios.delegate = MyDelegate;
}

if ( application.android ) {
    application.on( application.launchEvent, function ( args: application.ApplicationEventData ) {
        try {
            console.log('TnsOneSignal', TnsOneSignal);
            TnsOneSignal.startInit(application.android.context).init();
        } catch (error) {
            console.error('error', error);
        }
    });
}

Error: Command gradlew.bat failed with exit code 1

Hello,

I would like to create a Cross platform project using TNS.

I tried your tutorial and I ran few commands

  • tns create HelloWorld --template nativescript-template-tutorial
  • cd HelloWorld
  • tns run android

And ended up with the following stack-trace.

Would you please tell me what I am doing wrong?

Thanks a lot.
Mable John

The stack trace:

**λ tns run android**                                                                                                                               
Searching for devices...                                                                                                                        
Skipping prepare.                                                                                                                               
Building project...                                                                                                                             
Gradle build...                                                                                                                                 
         + applying user-defined configuration from E:\tns_repos\HelloWorld\app\App_Resources\Android\app.gradle                                
         + adding nativescript runtime package dependency: nativescript-optimized                                                               
         + adding aar plugin dependency: E:\tns_repos\HelloWorld\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar    
false                                                                                                                                           
                                                                                                                                                
**FAILURE: Build failed with an exception.**                                                                                                        
                                                                                                                                                
* Where:                                                                                                                                        
Build file 'E:\tns_repos\HelloWorld\platforms\android\build-tools\android-static-binding-generator\build.gradle' line: 63                       
                                                                                                                                                
* What went wrong:                                                                                                                              
Execution failed for task ':asbg:generateInterfaceNamesList'.                                                                                   
> Could not get unknown property 'jarFiles' for project ':asbg' of type org.gradle.api.Project.                                                 
                                                                                                                                                
* Try:                                                                                                                                          
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.                                  
                                                                                                                                                
* Get more help at https://help.gradle.org                                                                                                      
                                                                                                                                                
**BUILD FAILED** in 6s                                                                                                                              
Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.                                      

Help Implement Notification opened/received

Me code is:

TnsOneSignal.startInit(androidApp.context).init();

I need :
TnsOneSignal.handleNotificationOpened((jsonData) => {
console.log('didOpenRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
})

not found

Error after update to 1.0.8

After I update the plugin to 1.0.8 I have this error when I run tns run android.
@roblav96 Seems like your postinstall script have some errors.

Error: Cannot find module '/...app_folder/node_modules/postinstall-hooks.js'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
(node:25010) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit

Let me know if you need more info.

Error is: Command gradlew.bat failed with exit code 1

Hi,
I tried installing package nativescript-onesignal. After that, I got an error like UNMET PEER DEPENDANCY. Then I updated my modules following some posts on GitHub and StackOverflow. But, now when I try to build and run the application I got BUILD FAILED error. Unable to understand what went wrong. I followed some posts to resolve this but with no success.
Following is the error I got in the console.

>tns run android
Searching for devices...
Preparing project...
Successfully prepared plugin nativescript-camera for android.
Successfully prepared plugin nativescript-carousel for android.
Successfully prepared plugin nativescript-drop-down for android.
Successfully prepared plugin nativescript-filter-select for android.
Successfully prepared plugin nativescript-geolocation for android.
Successfully prepared plugin nativescript-gradient for android.
Successfully prepared plugin nativescript-imagepicker for android.
nativescript-iqkeyboardmanager is not supported for android.
Successfully prepared plugin nativescript-iqkeyboardmanager for android.
Successfully prepared plugin nativescript-loading-indicator for android.
Successfully prepared plugin nativescript-localstorage for android.
Successfully prepared plugin nativescript-locate-address for android.
Successfully prepared plugin nativescript-numeric-keyboard for android.
Successfully prepared plugin nativescript-onesignal for android.
Successfully prepared plugin nativescript-phone for android.
Successfully prepared plugin nativescript-social-share for android.
Successfully prepared plugin nativescript-telerik-ui for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin nativescript-webview-interface for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-i18n for android.
Successfully prepared plugin nativescript-permissions for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Configuring > 0/3 projects > root project
 :config phase:  createDefaultIncludeFiles
> Configuring > 0/3 projects > root project
 :config phase:  addAarDependencies
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Common-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Data-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\List-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Primitives-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_2xnifqnj4smqh1ggt6ywlsjt4.run(C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build-tools\android-static-binding-generator\build.gradle:144)
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:deleteGeneratedBindings UP-TO-DATE
:clean

BUILD SUCCESSFUL

Total time: 30.954 secs
Project successfully prepared (Android)
Building project...
> Configuring > 0/3 projects > root project
 :config phase:  createDefaultIncludeFiles
        +found plugins: nativescript-camera
         + creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-camera
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-camera -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F0
        +found plugins: nativescript-carousel
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-carousel -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F1
        +found plugins: nativescript-geolocation
         + creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-geolocation
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-geolocation -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F2
        +found plugins: nativescript-imagepicker
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-imagepicker -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F3
        +found plugins: nativescript-onesignal
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-onesignal -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F4
        +found plugins: nativescript-phone
         + creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-phone
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-phone -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F5
        +found plugins: nativescript-telerik-ui
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-telerik-ui -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F6
        +found plugins: nativescript-webview-interface
         + creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-webview-interface
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-webview-interface -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F7
        +found plugins: tns-core-modules-widgets
         + creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\tns-core-modules-widgets
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\tns-core-modules-widgets -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F8
> Configuring > 0/3 projects > root project
:config phase:  createPluginsConfigFile
         Creating product flavors include.gradle file in C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android/configurations folder...

:config phase:  pluginExtend
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-camera\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-carousel\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-geolocation\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-imagepicker\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-onesignal\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-phone\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-telerik-ui\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-webview-interface\include.gradle
        +applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\tns-core-modules-widgets\include.gradle
> Configuring > 0/3 projects > root project
 :config phase:  addAarDependencies
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Common-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Data-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\List-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Primitives-2017.1.719-dev-release.aar
        +adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_2xnifqnj4smqh1ggt6ywlsjt4.run(C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build-tools\android-static-binding-generator\build.gradle:144)
:preBuild UP-TO-DATE
:preF0F1F2F3F4F5F6F7F8DebugBuild UP-TO-DATE
:checkF0F1F2F3F4F5F6F7F8DebugManifest
:preF0F1F2F3F4F5F6F7F8ReleaseBuild UP-TO-DATE
:prepareAquaappRuntimeUnspecifiedLibrary
:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library
:prepareComAndroidSupportAppcompatV72600Alpha1Library
:prepareComAndroidSupportDesign2600Alpha1Library
:prepareComAndroidSupportRecyclerviewV72600Alpha1Library
:prepareComAndroidSupportSupportCompat2600Alpha1Library
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library
:prepareComAndroidSupportSupportFragment2600Alpha1Library
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library
:prepareComAndroidSupportSupportV42600Alpha1Library
:prepareComAndroidSupportSupportVectorDrawable2600Alpha1Library
:prepareComAndroidSupportTransition2600Alpha1Library
:prepareComGoogleAndroidGmsPlayServicesBase1104Library
:prepareComGoogleAndroidGmsPlayServicesBasement1104Library
:prepareComGoogleAndroidGmsPlayServicesGcm1104Library
:prepareComGoogleAndroidGmsPlayServicesIid1104Library
:prepareComGoogleAndroidGmsPlayServicesLocation1104Library
:prepareComGoogleAndroidGmsPlayServicesTasks1104Library
:prepareComOnesignalOneSignal362Library
:prepareComRomandanylykPageindicatorview020Library
:prepareCommon20171719DevReleaseLibrary
:prepareData20171719DevReleaseLibrary
:prepareList20171719DevReleaseLibrary
:preparePrimitives20171719DevReleaseLibrary
:prepareWidgetsReleaseLibrary
:prepareF0F1F2F3F4F5F6F7F8DebugDependencies
:compileF0F1F2F3F4F5F6F7F8DebugAidl
:compileF0F1F2F3F4F5F6F7F8DebugRenderscript
:generateF0F1F2F3F4F5F6F7F8DebugBuildConfig
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:generateTypescriptDefinitions SKIPPED
:copyTypings SKIPPED
:asbg:generateInterfaceNamesList
:asbg:traverseJsFiles
:asbg:runAstParser
Running full build
finished with reading lines with js files
:asbg:generateBindings
:generateF0F1F2F3F4F5F6F7F8DebugResValues
:generateF0F1F2F3F4F5F6F7F8DebugResources
:mergeF0F1F2F3F4F5F6F7F8DebugResources
:processF0F1F2F3F4F5F6F7F8DebugManifest
[com.onesignal:OneSignal:3.6.2] C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build\intermediates\exploded-aar\com.onesignal\OneSignal\3.6.2\AndroidManifest.xml:52:13-48 Error:
   Attribute meta-data#onesignal_app_id@value at [com.onesignal:OneSignal:3.6.2] AndroidManifest.xml:52:13-48 requires a placeholder substitution but no value for <onesignal_app_id> is provided.
[com.onesignal:OneSignal:3.6.2] C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build\intermediates\exploded-aar\com.onesignal\OneSignal\3.6.2\AndroidManifest.xml:56:13-67 Error:
   Attribute meta-data#onesignal_google_project_number@value at [com.onesignal:OneSignal:3.6.2] AndroidManifest.xml:56:13-67 requires a placeholder substitution but no value for <onesignal_google_project_number> is provided.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F0\AndroidManifest.xml Error:
    Attribute meta-data#onesignal_app_id@value at AndroidManifest.xml requires a placeholder substitution but no value for <onesignal_app_id> is provided.
C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F0\AndroidManifest.xml Error:
    Attribute meta-data#onesignal_google_project_number@value at AndroidManifest.xml requires a placeholder substitution but no value for <onesignal_google_project_number> is provided.
> Building 67% > :processF0F1F2F3F4F5F6F7F8DebugManifest
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:processF0F1F2F3F4F5F6F7F8DebugManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processF0F1F2F3F4F5F6F7F8DebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 7.429 secs
Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.

Please help me solve this.

Thank you..

Build issue

I am getting this error today when trying to do a build of my app. Not sure what I should do since there is nothing in the documentation on the app id

`com.onesignal:OneSignal:3.5.1] C:\ns\locallyepicapp\platforms\android\build\intermediates\exploded-aar\com.onesignal\OneSignal\3.5.1\AndroidManifest.xml:52:13
-48 Error:
Attribute meta-data#onesignal_app_id@value at [com.onesignal:OneSignal:3.5.1] AndroidManifest.xml:52:13-48 requires a placeholder substitution but no v
alue for <onesignal_app_id> is provided.
[com.onesignal:OneSignal:3.5.1] C:\ns\locallyepicapp\platforms\android\build\intermediates\exploded-aar\com.onesignal\OneSignal\3.5.1\AndroidManifest.xml:55:13
-67 Error:
Attribute meta-data#onesignal_google_project_number@value at [com.onesignal:OneSignal:3.5.1] AndroidManifest.xml:55:13-67 requires a placeholder substi
tution but no value for <onesignal_google_project_number> is provided.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

C:\ns\locallyepicapp\platforms\android\src\F1\AndroidManifest.xml:30:46-66 Error:
Attribute meta-data#onesignal_app_id@value value=(test) from AndroidManifest.xml:30:46-66
is also present at [com.onesignal:OneSignal:3.5.1] AndroidManifest.xml:52:13-48 value=(${onesignal_app_id}).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:30:3-69 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:processF0F1F2F3F4F5F6F7F8F9F10F11F12DebugManifest FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':processF0F1F2F3F4F5F6F7F8F9F10F11F12DebugManifest'.

Manifest merger failed : Attribute meta-data#onesignal_app_id@value value=(test) from AndroidManifest.xml:30:46-66
is also present at [com.onesignal:OneSignal:3.5.1] AndroidManifest.xml:52:13-48 value=(${onesignal_app_id}).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:30:3-69 to override.`

Thank You.

User not subscribing

Hi, my user is being shown on the OneSignal dashboard under total users, but not under subscribed users, what could be wrong?

How do I use the plug in to subscribe the user?

App constantly crashing on receiving notification

System.err: java.lang.RuntimeException: Unable to instantiate service org.nativescript.plugins.firebase.MyFirebaseMessagingService: java.lang.ClassNotFoundException: Didn't find class "org.nativescript.plugins.firebase.MyFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.ngasce.jforce-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ngasce.jforce-1/lib/arm, /data/app/com.ngasce.jforce-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
System.err: at android.app.ActivityThread.handleCreateService(ActivityThread.java:3282)
System.err: at android.app.ActivityThread.-wrap5(ActivityThread.java)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1618)
System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
System.err: at android.os.Looper.loop(Looper.java:154)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6316)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.nativescript.plugins.firebase.MyFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.ngasce.jforce-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ngasce.jforce-1/lib/arm, /data/app/com.ngasce.jforce-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
System.err: at android.app.ActivityThread.handleCreateService(ActivityThread.java:3279)
System.err: ... 8 more
System.err: Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessagingService;
System.err: at java.lang.VMClassLoader.findLoadedClass(Native Method)
System.err: at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
System.err: ... 10 more
System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.FirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.ngasce.jforce-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ngasce.jforce-1/lib/arm, /data/app/com.ngasce.jforce-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
System.err: ... 13 more
ActivityManager: Process com.ngasce.jforce (pid 20501) has died
ActivityManager: cleanUpApplicationRecord -- 20501

com.onesignal.OneSignalStateSynchronizer$UserState.access$1500

This error showed up in our crash reporting.
Any idea what caused it?

I cannot duplicate on any of our devices.

com.onesignal.OneSignalStateSynchronizer$UserState.access$1500 (OneSignalStateSynchronizer.java:227)
com.onesignal.OneSignalStateSynchronizer.getUserStateForModification (OneSignalStateSynchronizer.java:672)
com.onesignal.OneSignalStateSynchronizer.updateLocation (OneSignalStateSynchronizer.java:746)
com.onesignal.SyncService$1.complete (SyncService.java:67)
com.onesignal.LocationGMS.fireComplete (LocationGMS.java:208)
com.onesignal.LocationGMS.receivedLocationPoint (LocationGMS.java:233)
com.onesignal.LocationGMS.access$200 (LocationGMS.java:54)
com.onesignal.LocationGMS$GoogleApiClientListener.onConnected (LocationGMS.java:247)
com.google.android.gms.common.internal.zzm.zzq ()
com.google.android.gms.internal.zzaat.zzo ()
com.google.android.gms.internal.zzaar.zzwi ()
com.google.android.gms.internal.zzaar.onConnected ()
com.google.android.gms.internal.zzaav.onConnected ()
com.google.android.gms.internal.zzaag.onConnected ()
com.google.android.gms.common.internal.zzl$1.onConnected ()
com.google.android.gms.common.internal.zzf$zzj.zzxG ()
com.google.android.gms.common.internal.zzf$zza.zzb ()
com.google.android.gms.common.internal.zzf$zza.zzu ()
com.google.android.gms.common.internal.zzf$zze.zzxH ()
com.google.android.gms.common.internal.zzf$zzd.handleMessage ()
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:136)
android.app.ActivityThread.main (ActivityThread.java:5591)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1268)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1084)
dalvik.system.NativeStart.main (NativeStart.java)

TnsOneSignal undefined in Android

TnsOneSignal is undefined in Android with latest version installed with tns.

Any solution? com.onesignal.OneSignal is undefined as well.

Firebase breaks the app after installing OneSignal, plugin conflict

The versions that I installed are the following:
"nativescript-onesignal": "^1.0.8",
"nativescript-plugin-firebase": "^7.6.1",

After app build, it breaks and shows the following log:
JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'firebase' of undefined
JS: TypeError: Cannot read property 'firebase' of undefined
JS: at file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js:122288:38
JS: at new ZoneAwarePromise (file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js:114087:29)
JS: at addOnMessageReceivedCallback (file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js:122285:12)
JS: at Object.initFirebaseMessaging (file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js:122220:9)
JS: at runInit (file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js:120201:35)
JS: at file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js:120220:17
JS: at new ZoneAwarePromise (file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js:114087:29)
JS: at Object.push.../CORE_MOBILE/node_modules/nativescript-plugin-firebase/firebase.js.firebase_common_1.firebase.init (file:///data/data/org.nativescript.CoreMobile/files/app/v...
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.CoreMobile/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: TypeError: Cannot read property 'firebase' of undefined
System.err: File: "file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js, line: 122228, column: 29
System.err:
System.err: StackTrace:
System.err: Frame: function:'onAppModuleLaunchEvent', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 122228, column: 30
System.err: Frame: function:'', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 119911, column: 31
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 144837, column: 23
System.err: Frame: function:'notifyLaunch', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 162597, column: 17
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 162530, column: 28
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 162404, column: 14
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 160391, column: 25
System.err:
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
System.err: at android.app.ActivityThread.-wrap11(Unknown Source:0)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
System.err: at android.os.Looper.loop(Looper.java:164)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
System.err: Caused by: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: TypeError: Cannot read property 'firebase' of undefined
System.err: File: "file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js, line: 122228, column: 29
System.err:
System.err: StackTrace:
System.err: Frame: function:'onAppModuleLaunchEvent', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 122228, column: 30
System.err: Frame: function:'', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 119911, column: 31
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 144837, column: 23
System.err: Frame: function:'notifyLaunch', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 162597, column: 17
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 162530, column: 28
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 162404, column: 14
System.err: Frame: function:'push.../CORE_MOBILE/node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.CoreMobile/files/app/vendor.js', line: 160391, column: 25
System.err:
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:983)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:967)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:959)
System.err: at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:18)
System.err: at android.app.Activity.performCreate(Activity.java:7009)
System.err: at android.app.Activity.performCreate(Activity.java:7000)
System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
System.err: ... 9 more

can't register although app starts on iOS

Hello
I get errors on iOS while my app is going to start. everything is ok on Android. my main.ts file is:

// this import should be first in order to load some required settings (like globals and reflect-metadata)
import { platformNativeScriptDynamic } from "nativescript-angular/platform";

import { AppModule } from "./app/app.module";

import * as application from "tns-core-modules/application";
const TnsOneSignal = require("nativescript-onesignal").TnsOneSignal;
// A traditional NativeScript application starts by initializing global objects, setting up global CSS rules, creating, and navigating to the main page. 
// Angular applications need to take care of their own initialization: modules, components, directives, routes, DI providers. 
// A NativeScript Angular app needs to make both paradigms work together, so we provide a wrapper platform object, platformNativeScriptDynamic, 
// that sets up a NativeScript application and can bootstrap the Angular framework.

console.log("main starts");

if (application.ios) {
    class MyDelegate extends UIResponder implements UIApplicationDelegate {

        public static ObjCProtocols = [UIApplicationDelegate];

        public applicationDidFinishLaunchingWithOptions(app: UIApplication, launchOptions: NSDictionary<any, any>): boolean {

            try {

                console.log("TnsOneSignal", TnsOneSignal);
                // init to recieve push notification
                TnsOneSignal.initWithLaunchOptionsAppId(launchOptions, "b2fdda95-e2aa-494f-9873-ca8b92a1d43b");

                // I have not yet implemented the part of receiving notifications in ios, when I have it I will publish it

            } catch (error) {
                console.log("TnsOneSignal error", error);
            }

            return true;
        }

    }
    application.ios.delegate = MyDelegate;
}

if (application.android) {
    application.on(application.launchEvent, function(args: application.ApplicationEventData) {

        try {

            console.log("TnsOneSignal", TnsOneSignal);
            TnsOneSignal.ini(application.android.context).init()

        } catch (error) {
            console.error("error", error)
        }

    });
}

platformNativeScriptDynamic().bootstrapModule(AppModule);

errors:

ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignal Error Code=403 "(null)" UserInfo={returned=Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}}
ERROR: Encountered error during email registration with OneSignal: (null)

what can I do to solve the problem? anybody could install the plugin and implement it on iOS?

ios_attachments support?

I am trying to wire up ios_attachments, but the image does not come through. OneSignal says that ios_attachments are compatible with version 2.2.0 of their ios sdk, what version of their sdk does this plugin import?

v1.0.8 - Incompatible with TNS 3, 4 and 4.1

The hook provided with v1.0.8 is causing issues with TNS 3, 4 and 4.1

The specific problem is that it turns the platforms/android/app/build.gradle unusable.

In specific this text portion.

def pluginDependencies = nativescriptDependencies.collect {
        "$rootDir/${it.directory}
	      maven { url "https://plugins.gradle.org/m2/" }
/$PLATFORMS_ANDROID"
    }

This makes the whole compilation fail. I have also reproduced on a new clean project.

The error indicated when compiling is:

 build file '/my-project/platforms/android/app/build.gradle': 219: expecting anything but ''\n''; got it anyway @ line 219, column 34.
             "$rootDir/${it.directory}
                                      ^
  1 error

I have tried to modify the build.gradle in several ways to make this version work, but is just not working.

From removing the maven repo altogether, to put it after the repositories and inside of it.

Seems to me that the right way is to put it inside the repositories, but when I do that I get:

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

iOS Push Notifications Not Working

I followed the guide on the README and the android worked fine, but iOS won't even register a user. How exactly do I have to register an user and get the userId? I tried OneSignal.registerForPushNotifications and it didn't do anything either. Does it only work after the app is built and you get it from the app store? Or does it work with tns run ios to a physical iOS device too?

Google Play Services Library Error

In AndroidManifest.xml i write this
onesignal show
Google Play services library initialization error. Check for conflicting plugins and make sure "com.google.android.gms.version" is in your AndroidManifest.xml. Check the logcat for more details.
help me

Upcoming issue with iOS 13

I got this email... any thoughts on how to fix?

Hi there,

Due to a change that may occur as part of the upcoming iOS 13 release, you must update to the latest version of the iOS SDK before building your app with Xcode 11. All of OneSignal’s wrapper SDKs including React Native, Unity, and Flutter have been updated as well.

The reason for this is that Xcode 11, which is being released alongside iOS 13, breaks a common technique that apps and libraries like OneSignal were using to get a push token for the device. If you do not use our new SDK then new users will not be able to subscribe to notifications from your app.

This unannounced Xcode change was identified by the OneSignal team as part of our process of thoroughly testing all beta releases of iOS prior to their public launch. As soon as we became aware, we filed a bug report with Apple and updated our SDKs to ensure guarantee ongoing compatibility. By updating the SDK before your next app release, there will be no impact to your app or subscribers.

Thank you for using OneSignal and our team is available if you have any questions about this.

Best regards,
OneSignal Team

build problem

Hi!
I use nativescript angular latest version.
I use this plugin and work correct but if I build width webpack this error crash build app.
In tsconfig.js "noEmitOnError": false tns build and run jump this error but webpack not build app with this error. Please help me.

Cannot find name 'UIResponder'.
ERROR in app/main.ts (12,53): Cannot find name 'UIApplicationDelegate'.
ERROR in app/main.ts (13,40): Cannot find name 'UIApplicationDelegate'.
ERROR in app/main.ts (14,63): Cannot find name 'UIApplication'.
ERROR in app/main.ts (14,93): Cannot find name 'NSDictionary'.

Thank you for your help.
Bumbella

NativeScript angular2 actionCallback navigate

Hello,

I was able to configure the plugin. However, I am listening to actionCallback to get buttons and route to them. But since angular2 is not yet initiated in main.ts how would it work out? So on click a button depending on id of the button route to a angular2 component.

Regards

Android crash lot of devices

When marketing send push notifications to devices this days I get lot of errors in play console ANR & crash section:
executing service hu.praktiker/com.onesignal.SyncJobService
com.onesignal.SyncJobService
java.lang.ClassNotFoundException
dalvik.system.BaseDexClassLoader.findClass
Reports total 7,906 Lifetime
eports 7,906 Last 60 days

Anybody has idea where I going to debug?
Many thnx.
Miklos

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleCreateService (ActivityThread.java:3543)
  at android.app.ActivityThread.-wrap4 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1812)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:7000)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:125)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
  at android.app.ActivityThread.handleCreateService (ActivityThread.java:3540)

OR

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleCreateService (ActivityThread.java:3313)
  at android.app.ActivityThread.-wrap5 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1659)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:156)
  at android.app.ActivityThread.main (ActivityThread.java:6523)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:942)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:832)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:380)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
  at android.app.ActivityThread.handleCreateService (ActivityThread.java:3310)

OR

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleCreateService (ActivityThread.java:3502)
  at android.app.ActivityThread.-wrap6 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1732)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6776)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1496)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1386)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:380)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
  at android.app.ActivityThread.handleCreateService (ActivityThread.java:3499)

failed to run npm run build

got these errors when I tried to run the demo project.

image

here's my npm-log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]prebuild: [email protected]
6 info lifecycle [email protected]
build: [email protected]
7 verbose lifecycle [email protected]build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Projects\nativescript-onesignal\node_modules.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\user\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\user\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\user\bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\HashiCorp\Vagrant\bin;C:\Program Files\Git\cmd;C:\xampp\php;C:\Program Files\MongoDB\Server\4.0\bin;C:\xampp\mysql\bin;C:\ProgramData\ComposerSetup\bin;C:\Program Files (x86)\Yarn\bin;C:\ProgramData\chocolatey\bin;D:\ProgramFiles\android\android-sdk\tools;D:\ProgramFiles\android\android-sdk\platform-tools;D:\ProgramFiles\Java\jdk-8u181\bin;C:\Program Files\nodejs;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\user\AppData\Roaming\Composer\vendor\bin;C:\Users\user\AppData\Local\Yarn\bin;C:\Users\user\AppData\Roaming\npm
9 verbose lifecycle [email protected]build: CWD: D:\Projects\nativescript-onesignal
10 silly lifecycle [email protected]
build: Args: [ '/d /s /c', 'tsc' ]
11 silly lifecycle [email protected]build: Returned: code: 2 signal: null
12 info lifecycle [email protected]
build: Failed to exec build script
13 verbose stack Error: [email protected] build: tsc
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:915:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd D:\Projects\nativescript-onesignal
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
18 verbose node v8.12.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] build: tsc
22 error Exit status 2
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Build Failed

Build file 'mobile-app/platforms/android/build.gradle' line: 9

  • What went wrong:
    A problem occurred evaluating root project 'cloint'.

Could not find method maven() for arguments [build_4fm12iry20mhqjbe9e2xnugtm$_run_closure1$_closure3@8753f85] on object of type org.gradle.api.internal.initialization.DefaultScriptHandler.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s
Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.
Executing after-watch hook from mobile-app/hooks/after-watch/nativescript-dev-typescript.js
Stopping tsc watch

mobile-app/platforms/android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }

> 	      maven { url "https://plugins.gradle.org/m2/" }


    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
   	    classpath "gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.1, 0.99.99]"
 }
}

allprojects {
    repositories {
        google()
        jcenter()
    }

    maven { url "https://plugins.gradle.org/m2/" }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Above Error Occured in Addition to project

Not compatable for Android on NS CLI5+

I'm getting massive errors when trying to use this plugin on my Android app (iOS builds fine but users don't register with APNS) and would like to know if this can please be updated asap to cater for it.

How to get player id after registered device by using idsAvailable

I added idsAvailable after registered successfully as below but got error and failed to return any player id:
TnsOneSignal.idsAvailable(function(userId,registrationId) {
console.log("OneSignal User ID:", userId);
});

Error:
JS: error Error: Cannot convert object to Lcom/onesignal/OneSignal$IdsAvailableHandler; at index 0

Fatal Exception: android.app.RemoteServiceException

I was getting an error from firebase Crashlytics.

Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package com.ngasce.jforce: Couldn't create icon: StatusBarIcon(icon=Icon(typ=RESOURCE pkg=com.ngasce.jforce id=0x7f0b0003) visible user=0 ) at android.app.ActivityThread$H.handleMessage + 1881(ActivityThread.java:1881) at android.os.Handler.dispatchMessage + 105(Handler.java:105) at android.os.Looper.loop + 164(Looper.java:164) at android.app.ActivityThread.main + 6944(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run + 327(Zygote.java:327) at com.android.internal.os.ZygoteInit.main + 1374(ZygoteInit.java:1374)

Nativescript 2.5 + Angular

Hi,

anybody managed to get this working on Nativescript 2.5 + Angular app?

My main.ts looks like this

import { platformNativeScriptDynamic } from "nativescript-angular/platform";

import { AppModule } from "./app.module";

import { Config } from "./shared/config";
import * as application from 'application';
var TnsOneSignal = require('nativescript-onesignal').TnsOneSignal;

if (application.ios) {
    class MyDelegate extends UIResponder implements UIApplicationDelegate {

        public static ObjCProtocols = [UIApplicationDelegate]

        private applicationDidFinishLaunchingWithOptions(app: UIApplication, launchOptions: NSDictionary): boolean {

            try {

                console.dump('TnsOneSignal', TnsOneSignal)
                TnsOneSignal.initWithLaunchOptionsAppId(launchOptions, Config.ONESIGNAL);

            } catch (error) {
                console.error('error', error)
            }

            return true
        }

    }
    application.ios.delegate = MyDelegate
}

platformNativeScriptDynamic().bootstrapModule(AppModule);

And this is what I get when I try to build

bash-3.2$ tns build ios
Executing before-prepare hook from /Users/MyMac/Apps/myapps/mobile-agent/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.1.6
app/main.ts(10,11): error TS2420: Class 'MyDelegate' incorrectly implements interface 'UIApplicationDelegate'.
  Property 'applicationDidFinishLaunchingWithOptions' is private in type 'MyDelegate' but not in type 'UIApplicationDelegate'.

app/main.ts(14,93): error TS2314: Generic type 'NSDictionary<KeyType, ObjectType>' requires 2 type argument(s).

app/main.ts(18,17): error TS2346: Supplied parameters do not match any signature of call target.

node_modules/tns-platform-declarations/ios/objc-i386/objc!CoreAudio.d.ts(7,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'AudioBuffer' must be of type '{ new (): AudioBuffer; prototype: AudioBuffer; }', b
ut here has type 'StructType<AudioBuffer>'.

node_modules/tns-platform-declarations/ios/objc-i386/objc!UIKit.d.ts(4954,15): error TS2300: Duplicate identifier 'UIEvent'.

node_modules/tns-platform-declarations/ios/objc-i386/objc!UIKit.d.ts(4954,15): error TS2417: Class static side 'typeof UIEvent' incorrectly extends base class static side 'typeof NSObject'.
  Types of property 'alloc' are incompatible.
    Type '() => UIEvent' is not assignable to type '() => NSObject'.
      Type 'UIEvent' is not assignable to type 'NSObject'.
        Property 'accessibilityActivationPoint' is missing in type 'UIEvent'.

node_modules/typescript/lib/lib.d.ts(14991,11): error TS2300: Duplicate identifier 'UIEvent'.
node_modules/typescript/lib/lib.d.ts(14997,13): error TS2300: Duplicate identifier 'UIEvent'.

TypeScript compiler failed with exit code 1

I tried to remove/add platform ios and this is without typings defined in references, if I add them then I get lots of android typings errors.

thanks

Using with javascript

Hi,

am sorry for being a noob, but am new to nativescript and I want to use your plugin. my application uses javascript. can I use your plugin in my app or it has to be in typescript?

Thanks in advance!

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.