intent_launcher 0.0.1 intent_launcher: ^0.0.1 copied to clipboard
Provides a way to launch Android intents, e.g. opening a specific activity.
intent_launcher #
A Flutter plugin that provides a simple way to launch Android system settings and other activities through Intents. This package allows you to easily open various Android system settings screens and handle activity results from your Flutter application.
This package was inspired by and based on the excellent work done by Expo team with their expo-intent-launcher package.
Features #
- Launch Android system settings screens (WiFi, Bluetooth, Location, etc.)
- Open specific Android activities with custom parameters
- Handle activity launch results
- Support for intent extras, flags, and categories
- Rich set of predefined activity actions
- Type-safe API with strong Flutter integration
Platform Support #
Android | iOS | MacOS | Web | Linux | Windows |
---|---|---|---|---|---|
✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
Installation #
run
flutter pub add intent_launcher
Usage #
Basic Usage #
// Open Location settings
await startActivityAsync(ActivityAction.locationSourceSettings);
API Reference #
startActivityAsync
#
Launches an Android activity and returns the result.
Future<IntentLauncherResult> startActivityAsync(
String action, {
IntentLauncherParams params = const IntentLauncherParams(),
})
IntentLauncherParams
#
Configuration options for launching an activity.
class IntentLauncherParams {
final String? type; // MIME type
final String? category; // Intent category
final Map<String, dynamic>? extra; // Extra key-value pairs
final String? data; // URI data
final int? flags; // Intent flags
final String? packageName; // Target package name
}
IntentLauncherResult
#
Contains the result of an activity launch.
class IntentLauncherResult {
ResultCode? resultCode; // Success, canceled, or first user
String? data; // Result data URI
Map<String, dynamic>? extra; // Result extras
}
Common Activity Actions #
The package provides a comprehensive set of predefined activity actions, including:
ActivityAction.settings
- Open system settingsActivityAction.wifiSettings
- Open WiFi settingsActivityAction.bluetoothSettings
- Open Bluetooth settingsActivityAction.airplaneModeSettings
- Open airplane mode settingsActivityAction.securitySettings
- Open security settingsActivityAction.locationSourceSettings
- Open location settingsActivityAction.displaySettings
- Open display settingsActivityAction.dateSettings
- Open date & time settingsActivityAction.soundSettings
- Open sound settingsActivityAction.privacySettings
- Open privacy settings- And many more...
License #
This project is licensed under the MIT License - see the LICENSE file for details.