phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

'senderID’ does not exist in type ‘AndroidPushOptions’ #1998

Closed Boredude closed 7 years ago

Boredude commented 7 years ago

I'm trying to build my project for Ios and I get the following error

Type '{ android: { senderID: string; icon: string; iconColor: string; sound: true; }; ios: { alert: "tr...' is not assignable to type 'PushOptions'. Types of property 'android' are incompatible. Type '{ senderID: string; icon: string; iconColor: string; sound: true; }' is not assignable to type 'AndroidPushOptions'. Object literal may only specify known properties, and 'senderID' does not exist in type 'AndroidPushOptions'.

The exact same code gives no error when I use it on my windows machine and run it on android device.

Please help

Expected Behaviour

Build transpiles

Actual Behaviour

Error recieved on IOS platform

Reproduce Scenario (including but not limited to)

1. 2.

Steps to Reproduce

1. 2.

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

android ~6.2.2 blackberry10 ~3.8.0 (deprecated) browser ~4.1.0 ios ~4.4.0 osx ~4.0.1 webos ~3.7.0

cocoaPods version is 1.3.1

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI version and cordova platform version

cordova --version           7.0.1
cordova platform version ios  4.4.0

Plugin version

cordova plugin version | grep phonegap-plugin-push   2.0.0

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

macdonst commented 7 years ago

@Boredude you'll have to open an issue with Ionic as that is an error coming from their wrapper.

elbakly commented 7 years ago

just remove the senderID from the the android json like the link below and it will work fine. you already have that in the config xml

const options: PushOptions = {
   android: {},
   ios: {
       alert: 'true',
       badge: true,
       sound: 'false'
   },
   windows: {},
   browser: {
       pushServiceURL: 'http://push.api.phonegap.com/v1/push'
   }
};
 <plugin name="phonegap-plugin-push" spec="^1.10.5">
        <variable name="SENDER_ID" value="911xxxxxxxx" />
    </plugin>

https://ionicframework.com/docs/native/push/

BajajSaajan commented 6 years ago

The same process i am doing that but i am getting error while running on android device. that's No Value For senderID. please help me.

mattheuspirovani commented 6 years ago

@BajajSaajan and @Boredude change your options to a any object instead of a PushOptions like the follow snippet:

const options: any = {
  android: {
    senderID: "",
    sound: false,
    icon: 'notification',
    clearBadge: true
  },
  ios: {
    alert: 'true',
    badge: true,
    sound: 'false',
    clearBadge: true
  },
  windows: {}
};

It's a trick but will work...

BajajSaajan commented 6 years ago

@mattheuspirovani Thank you so much :)

eai301 commented 6 years ago

@mattheuspirovani it do the trick

senderID already have that in the config xml

guazarito commented 6 years ago

@mattheuspirovani

Thankkkksssssss a lot

lock[bot] commented 6 years ago

This thread has been automatically locked.