Android : Firebase Cloud Messaging

1. Create a new android project.
2. Copy package name from AndroidManifest.xml file.
3. GO: https://console.firebase.google.com/
4. Create a new project on firebase.
5. Now click on Add Firebase to Your Android App.
6. You will get a google-services.json file.
7. Copy google-services.json file to app folder 
8. Now go to build.gradle file and add the following code

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'    classpath 'com.google.gms:google-services:3.0.0'
}

9.Inside app level build.gradle file make the following changes.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'    })
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.google.firebase:firebase-messaging:9.2.0'    testCompile 'junit:junit:4.12'}

apply plugin: 'com.google.gms.google-services'

10. Now implement this code in your projcet : Source code 
11. Now add services in our AndroidManifest.xml file. 
12. Go to firebase console and select the app you created.
13. From the left menu select notification.
14.Now send message.

Enjoy :) 

মন্তব্যসমূহ

একটি মন্তব্য পোস্ট করুন

এই ব্লগটি থেকে জনপ্রিয় পোস্টগুলি

Github: Push an existing repository from the command line

Android : Enable/Disable wifi programmatically