Hello,
i am building ionic app,
for push notification, i have used cordova-plugin-fcm and all other code in fcm.js
but after installing plugin “cordova-plugin-fcm” i cant build android app anymore,
ERROR:
Could not resolve all dependencies for configuration ':_debugApkCopy'.
Could not find com.google.firebase:firebase-core:11.2.0. required by project
Could not find com.google.firebase:firebase-messeging:11.2.0. required by project
FCM.js
angular.module("home")
.factory("FCM", function (APIService, userData, $state, $rootScope) {
function initFCM() {
if (typeof (FCMPlugin) !== "undefined") {
FCMPlugin.getToken(function (token) {
APIService.addFCMToken({
tokenid: token,
loginid: userData.login.login_id,
}).then(function () {
service.receivePush();
})
}, function (error) {
alert(error);
});
FCMPlugin.onTokenRefresh(function (token) {
APIService.addFCMToken({
tokenid: token,
loginid: userData.login.login_id,
}).then(function () {
service.receivePush();
})
});
} else {
//alert( 'admob plugin not ready' );
}
}
var service = {
initFCM: initFCM,
receivePush: function () {
FCMPlugin.onNotification(function (data) {
if (data.wasTapped === false || data.wasTapped == undefined) {
//Notification was received in foreground. Maybe the user needs to be notified.
if (data.event == "1")
$rootScope.$broadcast("new-post", data);
if (data.event == "4")
$rootScope.$broadcast("update-vote", data);
if (data.event == "2")
$rootScope.$broadcast("update-like", data);
if (data.event == "3")
$rootScope.$broadcast("update-comment", data);
if (data.event == "5")
$rootScope.$broadcast("comment-like", data);
} else {
//Notification was received on device tray and tapped by the user.
$state.go("single-post", { companyId: data.company_id, postId: data.post_id });
}
});
},
subscribe: function (topic) {
FCMPlugin.subscribeToTopic(topic);
},
unsubscribe: function (topic) {
FCMPlugin.unsubscribeToTopic(topic);
}
}
return service;
})
Stackoverflow link: https://stackoverflow.com/questions/45793538/error-building-app-with-cordova-plugin-fcm-in-ionic-1
Thank you.