flutter_background_messenger 0.0.2 copy "flutter_background_messenger: ^0.0.2" to clipboard
flutter_background_messenger: ^0.0.2 copied to clipboard

PlatformAndroid

A Flutter plugin for sending SMS messages in the background on Android devices

flutter_background_messenger #

A Flutter plugin for sending SMS messages in the background on Android devices.

Features #

  • Send SMS messages from Flutter apps
  • Handle SMS permissions
  • Background message sending capability

Getting Started #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_background_messenger: ^0.0.1

Platform Specific Setup #

Android

  1. Add the following permissions to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
  1. Ensure your minSdkVersion is set to 21 or higher in your android/app/build.gradle file:
android {
    ...
    defaultConfig {
        ...
        minSdkVersion 21
    }
}

Usage #

To send an SMS message, use the following code:

import 'package:flutter_background_messenger/flutter_background_messenger.dart';

class MessagingExample {
    final messenger = FlutterBackgroundMessenger();

    Future<void> sendSMS() async {
        try {
            final success = await messenger.sendSMS(
            phoneNumber: '+1234567890',
            message: 'Hello from Flutter Background Messenger!',
            );

            if (success) {
                print('SMS sent successfully');
            } else {
                print('Failed to send SMS');
            }
        } catch (e) {
            print('Error sending SMS: $e');
        }
    }
}
1
likes
140
pub points
21%
popularity

Publisher

unverified uploader

A Flutter plugin for sending SMS messages in the background on Android devices

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_background_messenger