andrehtissot / cordova-plugin-fcm-with-dependecy-updated

Google FCM Push Notifications Cordova Plugin
MIT License
209 stars 277 forks source link

Not able to install latest plugin in because of old cocoapods url point and not getting notification permission as well #151

Closed naitikpatel1990 closed 4 years ago

naitikpatel1990 commented 4 years ago

Describe the bug I am using two firebase plugin in my app. Firebase-authentication and this one. Both have different cocopods URL.

SO first i got dual dependency error. Then i did manually download plugin change cocopods URL to CDN one and able to install it using my local plugin folder path.

Let me know if i did wrong. in above because that be affect my following issue.

I am not able to call fcm notification permission one.

Also weird is even in IOS device -->Settings--> My App, i can't find Notification section. Please check below screenshot

iPadSetting

Environment (please complete the following information):

Following is package.json:

{
  "name": "WeGoApplication",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/common": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/forms": "~8.1.2",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "@ionic-native/calendar": "^4.20.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/date-picker": "^5.23.0",
    "@ionic-native/diagnostic": "^5.27.0",
    "@ionic-native/facebook": "^5.26.0",
    "@ionic-native/fcm": "^5.27.0",
    "@ionic-native/file": "^5.21.4",
    "@ionic-native/firebase-authentication": "^5.21.5",
    "@ionic-native/geolocation": "^5.22.0-beta-1",
    "@ionic-native/google-plus": "^5.22.0-beta-1",
    "@ionic-native/ionic-webview": "^5.27.0",
    "@ionic-native/keyboard": "^5.24.0",
    "@ionic-native/native-geocoder": "^5.22.0-beta-1",
    "@ionic-native/native-storage": "^5.22.0-beta-1",
    "@ionic-native/social-sharing": "^5.22.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^4.7.1",
    "@logisticinfotech/ionic4-datepicker": "^1.4.3",
    "angular-material": "^1.1.22",
    "angular-mgl-timeline": "^0.3.3",
    "angularfire2": "^5.4.0",
    "cordova-android-support-gradle-release": "~3.0.1",
    "cordova-plugin-androidx": "1.0.2",
    "cordova-plugin-androidx-adapter": "1.1.0",
    "cordova-plugin-apprate": "^1.5.0",
    "cordova-plugin-calendar": "^5.1.5",
    "cordova-plugin-datepicker": "^0.9.3",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-facebook4": "^6.4.0",
    "cordova-plugin-file": "6.0.2",
    "cordova-plugin-firebase-authentication": "3.0.2",
    "cordova-plugin-geolocation": "^4.0.2",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-nativegeocoder": "^3.4.0",
    "cordova-plugin-nativestorage": "^2.3.2",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-plugin-whitelist": "1.3.3",
    "cordova-plugin-x-socialsharing": "5.6.4",
    "cordova-support-android-plugin": "1.0.1",
    "cordova-support-google-services": "1.3.2",
    "cordova.plugins.diagnostic": "^5.0.2",
    "core-js": "^2.5.4",
    "es6-promise-plugin": "4.2.2",
    "firebase": "^7.8.0",
    "intl": "^1.2.5",
    "ion2-calendar": "^3.0.0-rc.0",
    "ionic-header-parallax": "^2.2.2",
    "ionic4-date-picker": "^0.1.0",
    "ionic4-rating": "^1.0.9",
    "ionic4-star-rating": "^1.1.1",
    "moment": "^2.24.0",
    "ngx-material-timepicker": "^5.5.1",
    "ngx-smart-modal": "^7.4.0",
    "ngx-timeline-vertical": "^1.0.3",
    "ngx-vertical-timeline": "0.0.1",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "web-animations-js": "^2.3.2",
    "xcode": "^3.0.1",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    "@angular-devkit/build-angular": "^0.801.3",
    "@angular-devkit/core": "~8.1.2",
    "@angular-devkit/schematics": "~8.1.2",
    "@angular/animations": "^6.1.0",
    "@angular/cli": "^8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/compiler-cli": "~8.1.2",
    "@angular/language-service": "~8.1.2",
    "@ionic/angular-toolkit": "^2.1.1",
    "@ionic/app-scripts": "^3.2.4",
    "@ionic/lab": "3.1.7",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "cordova-android": "^8.1.0",
    "cordova-ios": "^6.0.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-fcm-with-dependecy-updated": "file:custom_plugins/cordova-plugin-fcm-with-dependecy-updated-master",
    "cordova-plugin-googleplus": "^8.5.0",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-file": {},
      "cordova-plugin-firebase-authentication": {
        "FIREBASE_AUTH_VERSION": "19.2.+"
      },
      "cordova-plugin-androidx": {},
      "cordova-plugin-androidx-adapter": {},
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
      },
      "cordova-plugin-nativestorage": {},
      "cordova-plugin-apprate": {},
      "cordova-plugin-datepicker": {},
      "cordova-plugin-calendar": {},
      "cordova-support-google-services": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
      },
      "cordova-plugin-nativegeocoder": {},
      "cordova-android-support-gradle-release": {
        "ANDROID_SUPPORT_VERSION": "27.+"
      },
      "cordova-plugin-facebook4": {
        "APP_ID": "1007026136379054",
        "APP_NAME": "Yo Tengo",
        "FACEBOOK_HYBRID_APP_EVENTS": "false",
        "FACEBOOK_ANDROID_SDK_VERSION": "5.13.0"
      },
      "cordova.plugins.diagnostic": {
        "ANDROID_SUPPORT_VERSION": "28.+"
      },
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "***********",
        "PLAY_SERVICES_VERSION": "15.0.1"
      },
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-fcm-with-dependecy-updated": {
        "ANDROID_FCM_VERSION": "19.0.0",
        "ANDROID_GRADLE_TOOLS_VERSION": "3.5.3",
        "ANDROID_GOOGLE_SERVICES_VERSION": "4.3.3",
        "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
      }
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

FYI: No issues with android. Android works completely fine

anshsoni143 commented 4 years ago

@andrehtissot @andretissot I am also facing the same issue as the android build is fine but for ios, I am unable to add the platform as it stuck on pod install and command: pod --version. I have to deliver my project today and due to a name and bundle id change I have to re-add the platform and rebuild but it got stuck on platform install

DaedalusAB commented 4 years ago

For permission on ios, make sure you call method fcmrequestpushpermission: https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated#fcmrequestpushpermission

naitikpatel1990 commented 4 years ago

Yes @DaedalusAB

But plugin is not able to install for iOS so that method for permission won't able to call.

DaedalusAB commented 4 years ago

Do you import FCM from @ionic-native/fcm or from 'cordova-plugin-fcm-with-dependancy-updated/...'

Make sure you use the latter and make sure you init the plugin after platform is ready.

Check here:

https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated/issues/113#issuecomment-651802194

naitikpatel1990 commented 4 years ago

Plugin is not installing at all.

Though I do have npm package install as you can check in my above package.json

anshsoni143 commented 4 years ago

@DaedalusAB when we add a platform for ios it stuck on pod install command: pod -version abd I am unable to move forward

DaedalusAB commented 4 years ago

@anshsoni143 maybe this helps: https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated/issues/150

naitikpatel1990 commented 4 years ago

@DaedalusAB

i am able to install plugin. But i do have one issue remain.

There is no notification section in Settings --> App ( as above question screenshot )

89819663-6faed800-db69-11ea-8596-2f5d7cd6ea6d

FYI i do add PushNotification in capabilities, following is screenshot of it.

Screenshot 2020-08-13 at 3 03 51 PM

Please guide me what i did wrong ?

anshsoni143 commented 4 years ago

@naitikpatel1990 how you added the plugin can you guid me

naitikpatel1990 commented 4 years ago

@anshsoni143

I did download zip of this plugin.

make folder called "custom_plugins" in my ionic project root directory. ( you can make anywhere but i prefer to set inside project only to get relative path when install )

then unzip your plugin in "custom_plugins" folder.

so now your plugin code will be like in ionicProject --> custom_plugins --> cordova-plugin-fcm-with-dependecy-updated-master

Now open plugin.xml from ionicProject --> custom_plugins --> cordova-plugin-fcm-with-dependecy-updated-master --> plugin.xml

do following changes in it:

<!-- FIREBASE COCOAPODS-->
    <!-- <podspec>
        <config>
            <source url="https://github.com/CocoaPods/Specs.git"/>
        </config>
        <pods>
            <pod name="Firebase/Analytics" spec=">= 6.21.0" />
            <pod name="Firebase/Messaging" spec=">= 6.21.0" />
        </pods>
    </podspec> -->

    <framework src="Firebase/Core" type="podspec" spec=">= 6.21.0"/>
    <framework src="Firebase/Analytics" type="podspec" spec=">= 6.21.0"/>
    <framework src="Firebase/Messaging" type="podspec" spec=">= 6.21.0"/>

SO above you need to commented some code and add 3 lines given in above code snippet:

Now add you plugin with following command:

ionic cordova plugin add custom_plugins/cordova-plugin-fcm-with-dependecy-updated-master

and it should able to install plugin.

anshsoni143 commented 4 years ago

@naitikpatel1990 what is your iOS version as i am using ios@latest

naitikpatel1990 commented 4 years ago

I am using ios 6.1.0

Which is latest i guess.

DaedalusAB commented 4 years ago

@naitikpatel1990 Make sure you call method requestPushPermission(), and make sure you call it after platform.ready()

Here is an example:

https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated-ionic-v5-example/blob/master/src/app/home/home.page.ts

naitikpatel1990 commented 4 years ago

@DaedalusAB

Thank you. It's working great now.

anshsoni143 commented 4 years ago

@naitikpatel1990 and @DaedalusAB Thanks for the help. Finally able to build and push app.