Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed google-services.json issue #292

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,26 @@

<!-- ANDROID CONFIGURATION -->
<platform name="android">
<preference name="ANDROID_DEFAULT_NOTIFICATION_ICON" default="@mipmap/ic_launcher" />
<preference name="ANDROID_FCM_VERSION" default="21.0.0" />
<preference name="ANDROID_FIREBASE_BOM_VERSION" default="26.0.0" />
<preference name="ANDROID_GOOGLE_SERVICES_VERSION" default="4.3.4" />
<preference name="ANDROID_GRADLE_TOOLS_VERSION" default="4.1.0" />

<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.gae.scaffolder.plugin.FCMPluginActivity" android:launchMode="singleTop">
<activity android:name="com.gae.scaffolder.plugin.FCMPluginActivity" android:launchMode="singleTop" android:exported="true">
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService"
android:stopWithTask="false">
android:stopWithTask="false" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="$ANDROID_DEFAULT_NOTIFICATION_ICON" />
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"/>
</config-file>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="FCMPlugin">
Expand Down
2 changes: 1 addition & 1 deletion src/android/FCMPlugin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ dependencies {
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
if (!project.plugins.hasPlugin('com.google.gms.google-services')) {
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
// apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}
10 changes: 5 additions & 5 deletions src/android/com/gae/scaffolder/plugin/FCMPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ public void getInitialPushPayload(CallbackContext callback) {

public void getToken(final TokenListeners<String, JSONObject> callback) {
try {
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(Task<InstanceIdResult> task) {
public void onComplete(Task<String> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "getInstanceId failed", task.getException());
try {
Expand All @@ -194,14 +194,14 @@ public void onComplete(Task<InstanceIdResult> task) {
}

// Get new Instance ID token
String newToken = task.getResult().getToken();
String newToken = task.getResult();

Log.i(TAG, "\tToken: " + newToken);
callback.success(newToken);
}
});

FirebaseInstanceId.getInstance().getInstanceId().addOnFailureListener(new OnFailureListener() {
FirebaseMessaging.getInstance().getToken().addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(final Exception e) {
try {
Expand All @@ -224,7 +224,7 @@ private void deleteInstanceId(final CallbackContext callbackContext) {
cordova.getThreadPool().execute(new Runnable() {
public void run() {
try {
FirebaseInstanceId.getInstance().deleteInstanceId();
FirebaseMessaging.getInstance().getToken();
callbackContext.success();
} catch (Exception e) {
callbackContext.error(e.getMessage());
Expand Down
4 changes: 4 additions & 0 deletions src/android/com/gae/scaffolder/plugin/mipmap/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">

</adaptive-icon>
2 changes: 1 addition & 1 deletion src/ios/FCMPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#import <Cordova/CDV.h>
#import <WebKit/WebKit.h>
#import "FCMPlugin.h"
#import <Firebase.h>
#import "Firebase.h"

@interface FCMPlugin () {}
@end
Expand Down