firebase_fcm_token 1.1.3 copy "firebase_fcm_token: ^1.1.3" to clipboard
firebase_fcm_token: ^1.1.3 copied to clipboard

A lightweight Flutter package for app status control with server integration and admin panel. Control your app remotely, crash the app when disabled by server, and manage everything through admin panel.

🎯 firebase_fcm_token #

pub package License: MIT

A lightweight Flutter package for app status control with server integration and admin panel. Control your app remotely, crash the app when disabled by server, and manage everything through admin panel.

🚨 Critical Feature: App Crash on Disable #

When your app is disabled by the server, the application will immediately crash with an Exception instead of showing a white screen. This ensures complete app control and prevents unauthorized usage.

⭐ Features #

  • 🚫 App Crash Control - Crashes app immediately when disabled by server
  • πŸ”₯ Exception Throwing - Throws clear exception: "UYGULAMA YΓ–NETΔ°CΔ° TARAFINDAN KAPATILMIŞTIR!"
  • πŸ›‘ Mandatory Stop - No bypass possible, app terminates completely
  • 🌐 Server Integration - Connect to your PHP server or custom backend
  • πŸ‘¨β€πŸ’Ό Admin Panel - Web-based control panel for managing apps
  • πŸ“± Lightweight - No Firebase dependencies, HTTP-only communication
  • ⚑ Fast Setup - Easy integration in 5 minutes

πŸš€ Quick Start #

1. Add to pubspec.yaml #

dependencies:
  firebase_fcm_token: ^1.1.3

2. Initialize in main.dart #

import 'package:flutter/material.dart';
import 'package:firebase_fcm_token/firebase_fcm_token.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize app control
  await FirebaseFcmToken().initialize(
    appName: 'my_awesome_app',
  );

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FirebaseFcmToken().buildAppStatusWidget(
      child: MaterialApp(
        title: 'My App',
        home: const HomePage(),
      ),
    );
  }
}

⚠️ Behavior When App Disabled #

When the server disables your app:

  1. Immediate Exception: App throws Exception('UYGULAMA YΓ–NETΔ°CΔ° TARAFINDAN KAPATILMIŞTIR! Program sonlandΔ±rΔ±lΔ±yor...')
  2. App Crash: Application terminates immediately
  3. No Bypass: Users cannot continue using the app
  4. Clear Message: Error message explains why app crashed

πŸ”§ API Reference #

FirebaseFcmToken Class #

initialize()

await FirebaseFcmToken().initialize(
  appName: 'your_app_name',    // Required: Your app identifier
  serverUrl: 'https://...',    // Optional: Custom server URL
);

buildAppStatusWidget()

Widget buildAppStatusWidget({required Widget child})

Returns a widget that crashes the app if disabled by server.

refreshAppStatus()

await FirebaseFcmToken().refreshAppStatus();

Manually refresh app status from server. Will crash app if disabled.

isAppEnabled

bool isEnabled = FirebaseFcmToken().isAppEnabled;

Check if app is currently enabled (before crash).

🌐 Server Setup #

Upload the included PHP files to your server:

your-domain.com/
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ index.php          # API endpoint
β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   β”œβ”€β”€ index.php      # Admin panel
β”‚   β”‚   └── style.css      # Admin styles
β”‚   └── config.php         # Database config

Database Structure #

CREATE TABLE apps (
    id INT AUTO_INCREMENT PRIMARY KEY,
    app_name VARCHAR(100) UNIQUE NOT NULL,
    is_enabled BOOLEAN DEFAULT TRUE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

Admin Panel Access #

  • URL: https://yourdomain.com/server/admin/
  • Password: admin123 (change in config.php)

πŸ›‘οΈ Security Features #

  • Forced Crash: No way to bypass disabled state
  • Exception Handling: Clear error messages
  • Server Validation: Regular status checks
  • Admin Control: Secure web panel access

πŸ“ Example Usage #

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final FirebaseFcmToken _controller = FirebaseFcmToken();

  Future<void> _checkStatus() async {
    try {
      // This will crash the app if disabled by server
      await _controller.refreshAppStatus();
      
      // This code only runs if app is enabled
      print('App is enabled: ${_controller.isAppEnabled}');
    } catch (e) {
      // App crashed due to being disabled
      print('App disabled and crashed: $e');
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('My App')),
      body: Center(
        child: ElevatedButton(
          onPressed: _checkStatus,
          child: Text('Check Status'),
        ),
      ),
    );
  }
}

πŸ”„ Version History #

  • v1.1.3 - Added app crash feature when disabled
  • v1.1.0 - Removed FCM dependencies, app control only
  • v1.0.0 - Initial release with FCM support

πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Support #

πŸ’– Contributing #

We welcome contributions! Please read our Contributing Guide for details.


⚠️ Important: This package will crash your app when disabled by server. This is intentional behavior for security and control purposes.

3
likes
150
points
16
downloads

Publisher

verified publishercinar.fun

Weekly Downloads

A lightweight Flutter package for app status control with server integration and admin panel. Control your app remotely, crash the app when disabled by server, and manage everything through admin panel.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on firebase_fcm_token