app_settings 4.0.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 99

app_settings #

pub package

A Flutter plugin for opening iOS and Android phone settings from an app.

Getting Started #

Include 'app_settings' from Dart Pub.

dependencies:
  flutter:
    sdk: flutter
  app_settings: 4.0.1+1

Next, import 'app_settings.dart' into your dart code.

import 'package:app_settings/app_settings.dart';

Platform Specifics #

The following setting options available on both iOS and Android: openAppSettings, openWIFISettings, openLocationSettings, openSecuritySettings, openBluetoothSettings, openDataRoamingSettings , openDateSettings, openDisplaySettings, openNotificationSettings, openSoundSettings, openInternalStorageSettings, openBatteryOptimizationSettings

iOS #

TIP: If using Objective-C for iOS in your project, you will need to add use_frameworks! to your Runner project podfile in order to use this Swift plugin:

- target 'Runner' do
    use_frameworks!

All options open the current 'app' settings section if there are settings defined. If no current settings are defined for the app the iPhone Settings Screen will be displayed.

Android #

Each option will open and display the exact corresponding system settings screen: WIFI, Location, or Security, etc.

Using the openAppSettings option will open the current 'app' settings for the running app.

In some cases, to access directly the Bluetooth window, you will need to provide access permissions in the android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.yourname.yourapp">   
	 <uses-permission android:name="android.permission.BLUETOOTH" />  
	 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />  
	 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>  
 <application

Example #

Example implementation using a raised button 'onPressed' event.

Widget build(BuildContext context) {
    return Row(
        children: <Widget>[
            RaisedButton(
                onPressed: AppSettings.openLocationSettings(),
                child: Text('Open Location Settings'),
            ),
        ],
    );
}

Platform Specifics #

The following setting options available on both iOS and Android: openAppSettings, openWIFISettings, openLocationSettings, openSecuritySettings, openBluetoothSettings, openDataRoamingSettings, openDateSettings, openDisplaySettings, openNotificationSettings, openSoundSettings

iOS #

All three options open the current 'app' settings section if there are settings defined. If no current settings are defined for the app the iPhone Settings Screen will be displayed.

Android #

Each option will open and display the corresponding screen: WIFI, Location, or Security, etc.

4.0.1+1 #

Update Android compileSdkVersion to 30

4.0.1 #

Added Battery Optimization settings access for Android. iOS will still rely on App Settings.

4.0.0 #

Updates Gradle wrapper distribution from 4.6 -> 6.2.2

Updates Kotlin plugin version from 1.3.50 -> 1.3.70

Updates Android Gradle plugin from 3.5.1 -> 3.6.1

Updates compileSdkVersion from 28 -> 'android-R'

Also removes generated/non-essential files, updates .gitignore to the latest flutter create standard and "fixes" faulty example test. Tested and working on Android R. Should probably be tested on lower API devices as well.

3.0.1 #

Added Internal Storage settings access for Android. iOS will still rely on App Settings.

3.0.0+1 #

Update plugin version in .podspec

3.0.0 #

Upgrade to Swift version: 5.0.1 - This version will only work on projects running Swift 5.0.1

2.0.2 #

Legacy Swift 4 support.

2.0.2 #

Added Date, Display, Notification, and Sound settings access for Android. iOS will still rely on App Settings.

2.0.1+1 #

Added Bluetooth & Data Roaming settings access for Android (more to come). iOS will still rely on App Settings.

2.0.0 #

Update AGP, migrate to AndroidX

1.0.6+2 #

Added missing podspec description

1.0.6+1 #

iOS TIP: If using Objective-C for iOS in your project, you will need to add use_frameworks! to your Runner project podfile in order to use this Swift plugin:

- target 'Runner' do
    use_frameworks!

1.0.6 #

Add openAppSettings() to access platform specific 'app' settings menu.

1.0.5 #

Ensure the plugin stays compatible with iOS8+. Declare Swift compatibility version 4.2.

1.0.4 #

Upgrading Kotlin version from: ext.kotlin_version = '1.2.71' to ext.kotlin_version = '1.3.20'

1.0.3 #

Adding additional documentation.

example/lib/main.dart

import 'dart:async';

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

/// Main method to return runApp.
void main() => runApp(MyApp());

/// This is the main app stateful widget.
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

/// This is the app state.
class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    /// Call out to intialize platform state.
    initPlatformState();
    super.initState();
  }

  /// Initialize platform state.
  Future<void> initPlatformState() async {
    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;
  }

  /// Widget build method to return MaterailApp.
  @override
  Widget build(BuildContext context) {
    var actionItems = getListOfActionButtons();
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('App Settings Example App'),
            ),
            body: GridView.count(
                crossAxisCount: 2,
                childAspectRatio: 2,
                children: List.generate(actionItems.length, (index) {
                  return Center(
                      child: ButtonTheme(
                    colorScheme: ColorScheme.dark(),
                    minWidth: 150.0,
                    child: actionItems[index],
                  ));
                }))));
  }

  List<Widget> getListOfActionButtons() {
    var actionItems = List<Widget>();

    actionItems.addAll([
      RaisedButton(
        child: Text("WIFI"),
        onPressed: () {
          AppSettings.openWIFISettings();
        },
      ),
      RaisedButton(
        child: Text("Location"),
        onPressed: () {
          AppSettings.openLocationSettings();
        },
      ),
      RaisedButton(
        child: Text("Security"),
        onPressed: () {
          AppSettings.openSecuritySettings();
        },
      ),
      RaisedButton(
        child: Text("App Settings"),
        onPressed: () {
          AppSettings.openAppSettings();
        },
      ),
      RaisedButton(
        child: Text("Bluetooth"),
        onPressed: () {
          AppSettings.openBluetoothSettings();
        },
      ),
      RaisedButton(
        child: Text("Data Roaming"),
        onPressed: () {
          AppSettings.openDataRoamingSettings();
        },
      ),
      RaisedButton(
        child: Text("Date"),
        onPressed: () {
          AppSettings.openDateSettings();
        },
      ),
      RaisedButton(
        child: Text("Display"),
        onPressed: () {
          AppSettings.openDisplaySettings();
        },
      ),
      RaisedButton(
        child: Text("Notification"),
        onPressed: () {
          AppSettings.openNotificationSettings();
        },
      ),
      RaisedButton(
        child: Text("Sound"),
        onPressed: () {
          AppSettings.openSoundSettings();
        },
      ),
      RaisedButton(
        child: Text("Internal Storage"),
        onPressed: () {
          AppSettings.openInternalStorageSettings();
        },
      ),
      RaisedButton(
        child: Text("Battery optimization"),
        onPressed: () {
          AppSettings.openBatteryOptimizationSettings();
        },
      ),
    ]);

    return actionItems;
  }

  /// Dispose method to close out and cleanup objects.
  @override
  void dispose() {
    super.dispose();
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  app_settings: ^4.0.1+1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:app_settings/app_settings.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
97
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
99
Learn more about scoring.

We analyzed this package on Jul 1, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:app_settings/app_settings.dart]

Package does not support Flutter platform macos

Because of import path [package:app_settings/app_settings.dart]

Package does not support Flutter platform web

Because of import path [package:app_settings/app_settings.dart]

Package does not support Flutter platform windows

Because of import path [package:app_settings/app_settings.dart]

Package not compatible with SDK dart

because of import path [app_settings]

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8