FCM -2018-03-20기준
cordova버전을 전부 업데이트후 fcm을 추가하니 추가가 되지 않았다.
똑같은 문제를 물어본사람도 있지만 답변은 없다.
https://stackoverflow.com/questions/48225748/ionic-cordova-fcm-notifications-error-with-firebase
- 이쪽에 내용이 올라오고있는거같은데 해결되면 최신버전으로 업그레이드를 해본다.
https://github.com/fechanique/cordova-plugin-fcm/issues/438
FCM플러그인 개발이 븅신같아서
https://github.com/fechanique/cordova-plugin-fcm/issues/435
npm uninstall -g cordova
npm install -g cordova@7.1.0
cordova version
을
다운그레이드해서
해결했다
.
현재 글작성 기준 cordova는 8.0버전이 출시되었다.
http://cordova.apache.org/blog/
cordova -v
7.1.0
2. 프로젝트 이름설정
3. google-services.json 파일 다운로드
4. 타겟 폴더에 해당파일을 이동시킨다.
5. 플랫폼 및 플러그인 추가하면 자동으로 해당파일이 포함된다.
cordova platform add android
cordova platform version
Installed platforms:
android 6.3.0
cordova plugin add cordova-plugin-fcm
---
해당 코드추가
FCMPlugin.getToken(function(token){ alert(token); });
실제 토큰 확인
FCMPlugin.onNotification(function(data){ if(data.wasTapped){ //Notification was received on device tray and tapped by the user. alert( JSON.stringify(data) ); }else{ //Notification was received in foreground. Maybe the user needs to be notified. alert( JSON.stringify(data) ); } });
테스트용
https://cordova-plugin-fcm.appspot.com/
---
2018-03-22
- more than one library with package name 'com.google.android.gms.license'
8.0버전으로 다시 업데이트
cordova platform add android@6.4.0