GCM to FCM 마이그레이션 가이드

1) AndroidManifest.xml 수정

<permission android:name="<your-package-name>.permission.C2D_MESSAGE"
            android:protectionLevel="signature" />
<uses-permission android:name="<your-package-name>.permission.C2D_MESSAGE" />

<receiver
    android:name="com.apms.sdk.push.PushReceiver"
    android:exported="true"
    android:permission="com.google.android.c2dm.permission.SEND">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    </intent-filter>
    <intent-filter>
        <action android:name="org.mosquitto.android.mqtt.MSGRECVD" />
        <category android:name="${applicationId}" />
    </intent-filter>
</receiver>
<!-- Private PUSH Receiver -->
<receiver android:name="com.apms.sdk.push.PushReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.google.android.fcm.intent.RECEIVE"/>
        <action android:name="org.mosquitto.android.mqtt.MSGRECVD"/>
    </intent-filter>
</receiver>
<service
    android:name="com.apms.sdk.push.FCMPushService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
</service>
    

2) Gradle 수정

app.gradle

compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.firebase:firebase-core:16.0.5'
compile 'com.google.firebase:firebase-messaging:17.3.4'
apply plugin: 'com.google.gms.google-services'

build.gradle

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

3) google-service.json 파일 프로젝트에 추가