6. 추가 설정
Eclipse/(Fail) FCM with Eclipse.No support By G[참고] https://blog.naver.com/websearch/220830134106
- strings.xml 과 google-services.json 에 아래 내용을 추가
Eclipse Project > res > values > strings.xml 을 열어, 아래 내용을 추가.
<string name="default_web_client_id" translatable="false"></string>
<string name="firebase_database_url" translatable="false"></string>
<string name="gcm_defaultSenderId" translatable="false"></string>
<string name="google_api_key" translatable="false"></string>
<string name="google_app_id" translatable="false"></string>
<string name="google_storage_bucket" translatable="false"></string>
- Firebase 에서 google-services.json 파일을 다운로드 받아 아래 내용을 추가
(Firebase 로그인후, 앱을 선택한 다음, 기어아이콘.Project Setting 를 누르면 다운로드 받을 수 있다.)
- 왼쪽이 strings.xml 파일의 name 이고 오른쪽이 google-services.json 파일의 항목을 의미한다.
* default_web_client_id : client -> oauth_client -> client_id
* firebase_database_url : project_info -> firebase_url
* gcm_defaultSenderId : project_info -> project_number
* google_api_key : client -> api_key -> current_key
* google_app_id : client -> client_info -> mobilesdk_app_id
* google_storage_bucket : project_info -> storage_bucket
- AndroidManifest.xml 을 수정.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.namespace.project"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21" />
<!-- FCM Message Receive Permission.Begin -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<permission android:name="com.testfcm.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="com.testfcm.permission.C2D_MESSAGE"/>
<!-- FCM Message Receive Permission.End -->
<application
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.namespace.project.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- FCM Message/ID Receive Service.Below Application Tag.BEGIN -->
<service android:name=".FCMService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".FCMIDService" >
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<!-- FCM Message/ID Receive Service.Below Application Tag.END -->
<!-- FCM Receiver.BEGIN -->
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" 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"/>
<category android:name="com.namespace.project"/>
</intent-filter>
</receiver>
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" >
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</receiver>
<!-- FCM Receiver.END -->
<!-- FCM Provider.BEGIN -->
<provider
android:authorities="com.com.namespace.proejct.firebaseinitprovider"
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:initOrder="100" />
<!-- FCM Provider.END -->
</application>
</manifest>
'Eclipse > (Fail) FCM with Eclipse.No support By G' 카테고리의 다른 글
이클립스에 FIrebase Jar 추가하기 (0) | 2018.05.04 |
---|---|
5. 이클립스에 FCM Jar 설치하는 방법 (0) | 2018.04.30 |
4. 이클립스 + FCM (0) | 2018.04.26 |
3. App 에 등록 (0) | 2018.04.26 |
2. FireBase 에서 프로젝트 만들기 (0) | 2018.04.26 |