havesource / cordova-plugin-push

Register and receive push notifications
MIT License
146 stars 280 forks source link

Push Plugin does not init & register correctly (and not return registrationId) #169

Open mikenetcode opened 2 years ago

mikenetcode commented 2 years ago

Bug Report

Push Plugin does not init & register correctly (and not return registrationId), due to following compile errors: > Task :app:compileDebugKotlin w: .../platforms/android/app/src/main/java/com/adobe/phonegap/push/FCMService.kt: (603, 33): 'constructor Builder(Context)' is deprecated. Deprecated in Java w: .../platforms/android/app/src/main/java/com/adobe/phonegap/push/FCMService.kt: (1166, 37): 'fromHtml(String!): Spanned!' is deprecated. Deprecated in Java w: .../platforms/android/app/src/main/java/com/adobe/phonegap/push/PushPlugin.kt: (465, 52): 'getter for token: String?' is deprecated. Deprecated in Java

I also see the following warning during compilation: Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.

Expected Behaviour

Actual Behaviour

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Just add plugin to an ionic project & try to compile for android (= ionic cordova build android)

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

JAVA: java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

NODE.js: v14.18.3 NPM: 8.4.0 BOWER: 1.8.8 IONIC CLI: 6.18.1 CORDOVA CLI: 11.0.0

Installed platforms: android 10.1.1 browser 6.0.0 ios 6.2.0

GULP: [21:32:48] CLI version 2.0.1 GRADLE: Gradle 7.2 Build time: 2021-08-17 09:59:03 UTC Revision: a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin: 1.5.21 Groovy: 3.0.8 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 1.8.0_251 (Oracle Corporation 25.251-b08) OS: Mac OS X 10.16 x86_64

Ionic: Ionic CLI : 6.18.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.9.3 @angular-devkit/build-angular : 12.2.16 @angular-devkit/schematics : 12.2.16 @angular/cli : 12.2.16 @ionic/angular-toolkit : 5.0.3

Cordova: Cordova CLI : 11.0.0 Cordova Platforms : android 10.1.1, browser 6.0.0, ios 6.2.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 28 other plugins)

Utility: cordova-res : 0.15.4 native-run : 1.5.0

System: Android SDK Tools : 26.1.1 (/Users/michaelschink/Library/Android/sdk) ios-deploy : 1.9.4 ios-sim : 8.0.2 NodeJS : v14.18.3 (/usr/local/bin/node) npm : 8.4.0 OS : macOS Monterey Xcode : Xcode 13.2.1 Build version 13C100

(Android) Device Vendor (e.g. Samsung, HTC, Sony...)

cordova info Printout

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

with adb logcat | grep PushPlugin:

02-24 10:57:00.410 20501 20583 V cordova-plugin-push (PushPlugin): Execute: Action = hasPermission 02-24 10:57:00.423 20501 20586 D cordova-plugin-push (PushPlugin): Execute::HasPermission: (Has Notification Permission: true) 02-24 10:57:01.031 20501 20583 V cordova-plugin-push (PushPlugin): Execute: Action = createChannel 02-24 10:57:01.031 20501 20586 V cordova-plugin-push (PushPlugin): Execute::CreateChannel 02-24 10:57:01.034 20501 20583 V cordova-plugin-push (PushPlugin): Execute: Action = listChannels 02-24 10:57:01.035 20501 20586 V cordova-plugin-push (PushPlugin): Execute::ListChannels 02-24 10:57:01.058 20501 20583 V cordova-plugin-push (PushPlugin): Execute: Action = init 02-24 10:57:01.059 20501 20586 V cordova-plugin-push (PushPlugin): Execute::Initialize: (Data=[{"android":{"icon":"push","sound":true,"vibrate":true,"clearBadge":true,"clearNotifications":true,"forceShow":false,"messageKey":"message","titleKey":"title"},"ios":{"voip":false,"alert":true,"badge":true,"sound":true,"clearBadge":true},"windows":{},"browser":{"pushServiceURL":"http:\/\/push.api.phonegap.com\/v1\/push"}}]) 02-24 10:57:01.064 20501 20586 V cordova-plugin-push (PushPlugin): Execute::Initialize: (JSONObject={"icon":"push","sound":true,"vibrate":true,"clearBadge":true,"clearNotifications":true,"forceShow":false,"messageKey":"message","titleKey":"title"}) 02-24 10:57:01.064 20501 20586 V cordova-plugin-push (PushPlugin): Execute::Initialize: (senderID=xxxxxxxxxxxx) 02-24 10:57:01.065 20501 20586 E cordova-plugin-push (PushPlugin): Execute::Initialize: (Firebase Token Exception Default FirebaseApp is not initialized in this process at.xxx.xxxxx. Make sure to call FirebaseApp.initializeApp(Context) first.) 02-24 10:57:01.066 20501 20586 E cordova-plugin-push (PushPlugin): Execute::Initialize: (Firebase Token Exception Default FirebaseApp is not initialized in this process at.xxx.xxxxx. Make sure to call FirebaseApp.initializeApp(Context) first.) 02-24 10:57:01.066 20501 20586 V cordova-plugin-push (PushPlugin): Execute::Initialize: (onRegistered={"registrationType":"FCM"}) 02-24 10:57:01.067 20501 20586 D cordova-plugin-push (PushPlugin): Execute::Initialize: (No Icon Color Options)

dilo99 commented 2 years ago

Hi @mikenetcode, were you able to solve this? because I was able to compile with this plugin until March 25th, today at March 31st, I have the same errors in the build phase, which do not allow me to proceed... I do not know how it is possible

mikenetcode commented 1 year ago

Hi @mikenetcode, were you able to solve this? because I was able to compile with this plugin until March 25th, today at March 31st, I have the same errors in the build phase, which do not allow me to proceed... I do not know how it is possible

Hi @dilo99 did you find a solution, because i did not.