Skip to content

Latest commit

 

History

History
162 lines (121 loc) · 5.41 KB

File metadata and controls

162 lines (121 loc) · 5.41 KB

Android-Fcm-Sender

Hits Platform Min SDK Jitpack

한국어 README

Overview

Android-Fcm-Sender is a testing library for Firebase Cloud Messaging (FCM) that provides a ready-to-use Activity for sending push notifications directly from your Android device without needing a backend server.

Main Screen No JSON Uploaded Property Settings
Notification Send Data Send Delete Data


This library enables quick verification of push notification functionality during development and QA stages. Simply add it to your project and launch the provided Activity to compose and send push messages locally using the FCM HTTP v1 API without needing the Firebase Console or a separate backend server.


Features

  • Service Account Key Management: Upload and manage Firebase Service Account JSON files
  • Notification Field Configuration: Configure title, body, image, channelId, and other notification properties
  • Data Field Configuration: Add custom key-value data payloads
  • Priority Settings: Specify message priority (high/normal) for delivery
  • Real-time Transmission Testing: Direct FCM API calls with response verification
  • UI-based Operation: Easy testing with a pre-built Activity interface

Installation

Step 1: Add Jitpack repository

Add the Jitpack repository to your project's settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

Step 2: Add dependency

Add the library to your module's build.gradle.kts:

dependencies {
    implementation("com.github.DongLab-DevTools:Android-Fcm-Sender:latestVersion")
}

Requirements

  • Android API 24 (Android 7.0) or higher
  • Firebase project with Cloud Messaging enabled
  • Firebase Service Account JSON key file

Usage

Launch FCM Sender Activity

Simply launch the FCM Sender Activity from anywhere in your app:

import android.content.Intent
import com.your.package.FcmSenderActivity

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // Launch FCM Sender Activity
        findViewById<Button>(R.id.openFcmSender).setOnClickListener {
            val intent = Intent(this, FcmSenderActivity::class.java)
            startActivity(intent)
        }
    }
}

Using the FCM Sender Screen

  1. Obtain Firebase Service Account Key

    • Go to Firebase Console
    • Select your project
    • Navigate to Project Settings → Service Accounts
    • Click Generate New Private Key and download the JSON file
  2. Upload JSON File

    • Tap the upload button in the FCM Sender Activity
    • Select your Service Account JSON file
    • The app will parse and store the credentials
  3. Configure Message

    • Device Token: Enter the FCM registration token of the target device
    • Title: Notification title
    • Body: Notification message body
    • Image URL: (Optional) Image URL for rich notifications
    • Channel ID: Android notification channel ID
    • Priority: Select HIGH or NORMAL
  4. Send Message

    • Tap the Send button to transmit via FCM HTTP v1 API
    • View the response status and any errors

Tech Stack

Category Details
Language Kotlin
Platform Android (minSdk 24)
API Firebase Cloud Messaging HTTP v1
Authentication Google Service Account OAuth2 (JWT)
Libraries Retrofit2, Gson, OkHttp

Upcoming Features

  • Message History: Save and resend previous messages
  • Log Viewer: View success/failure logs for sent messages
  • Template System: Save frequently used message structures
  • Payload Preview: JSON formatting and pre-send validation
  • Theme Support: Dark/Light mode toggle