spencerccf / app_settings Goto Github PK
View Code? Open in Web Editor NEWFlutter plugin for accessing app phone settings for iOS and Android
License: MIT License
Flutter plugin for accessing app phone settings for iOS and Android
License: MIT License
Could not determine the dependencies of task ':compileReleaseAidl'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in
your project's local properties file at
'/Users/username/Desktop/devEnv/flutter/.pub-cache/hosted/pub.dartlang.org/app_settings-4.0.4/android/local.properties'.
When I try to build on iOS I got this error:
/usr/local/Caskroom/flutter/latest/flutter/.pub-cache/hosted/pub.dartlang.org/app_settings-4.0.0/ios/Classes/SwiftAppSettingsPlugin.swift:8:46: 'openSettingsURLString' has been renamed to 'UIApplicationOpenSettingsURLString'
Tried with Swift 4.0 and 4.2.
Am I the only one having this issue?
Thanks π
Would you be interested in a PR for a scaled-down version of this plugin in pure Java instead of Kotlin?
At this moment, Kotlin requires you to bundle the kotlin stdlib plus whenever a kotlin version upgrade is done on the app client side, builds may break.
To help avoid method channel name collisions please add a namespace to your plugins method channel.
classpath 'com.android.tools.build:gradle:3.5.3'
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535], locale en-US)
* What went wrong:
A problem occurred evaluating root project 'app_settings'.
> Failed to apply plugin [id 'com.android.library']
> Minimum supported Gradle version is 5.4.1. Current version is 4.6. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Qiu\AppData\Roaming\Pub\Cache\hosted\pub.flutter-io.cn\app_se
ttings-3.0.0+1\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.4.1-all.zip
Could not determine the dependencies of task ':app_settings:compileReleaseAidl'.
Failed to find Platform SDK with path: platforms;android-R
build.gradle
compileSdkVersion 29
pubspec.yaml
app_settings: ^4.0.1
Hi!
My app was fully compiled and i was testing yesterday without any problem.
Today i had to compile another version and now i got this error
GeneratedPluginRegistrant.m:10:9: fatal error: module 'app_settings' not found
@import app_settings;
i`m using ( app_settings: ^4.0.4) and even with the older version the errors are the same.
can you help me ?
With the release of a stable API for Android 11 the 'android-R' SDK has been removed and replaced with 30. Due to this removal you can't build the project at this time.
The fix should be moving the compileSdkVersion
in android/build.gradle
to 30
app_settings: ^3.0.0+1
What setting we should define in order to open location settings (under privacy) not just phone settings page.We need to forward user to the page where he can enable locations settings.
Platform Specifics #
The following setting options available on both iOS and Android: openAppSettings, openWIFISettings, openLocationSettings, openSecuritySettings, openBluetoothSettings, openDataRoamingSettings, openDateSettings, openDisplaySettings, openNotificationSettings, openSoundSettingsiOS #
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.
You're not supposed to use example.com
. The Android platform part would need a correct ID. Yes, the IDE starts a project with it but you're supposed to change it. If you don't have a domain name of your own, you could probably use io.flutter.plugins
but you should probably ask. :-)
HI,
I use AppSettings.openWIFISettings();
But it always show the app settings.
Any way to go to general settings instead?
Thanks
Can you implement the option to go to iPhone Settings (even if the app have its own) and to go to Bluetooth settings (even if it just android)?
Can I not set the current settings for the application?
Android Emulator Pixel 3 XL
When calling AppSettings.openNotificationSettings the device navigates to Do Not Disturb settings.
Additionally, it interrupts the app history and does not allow for easy navigation back to the calling Flutter application
app_settings: ^3.0.0+1
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G2022, locale en-US)
[β] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[β] Xcode - develop for iOS and macOS (Xcode 11.1)
[β] Android Studio (version 3.5)
[β] VS Code (version 1.39.2)
[β] Connected device (1 available)
@spencerccf Hi!, Awesome plugin π . I came across this plugin in need of changing notification settings. Well I found out that AppSettings.openNotificationSettings();
opens Do not Disturb settings instead of Notifications settings.
You can replace above code with this one:
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.putExtra(Settings.EXTRA_APP_PACKAGE, this.registrar.activity().getPackageName())
this.registrar.activity().startActivity(intent);
I had the same issue #34 and fixed it by the above code. But still i think there should be version check to avoid further issues.
Check this question on stack overflow for more info: https://stackoverflow.com/questions/32366649/any-way-to-link-to-the-android-notification-settings-for-my-app
When I call AppSettings.openAppSettings();
on Android it opens the app storage settings
screen, instead app settings
.
sorry the readme guide is very short and brief
i couldnt understand how to open wifi settings and mobile data settings in ios?
Would it be possible to implement battery panel opening for iOS ?
For android there already are a few plugins, we might also port it here?
Hi, I am using your library in my project, and need to open the mobile data settings, can you update that part?
I have used the app_settings in my code, and after using it for the implementation in the emulator iOS, it only throws error :
#1 AppSettings.openAppSettings (package:app_settings/app_settings.dart:25:14) <asynchronous suspension> #2 _HomeContainerState.permission.<anonymous closure>.<anonymous closure> (package:newmonkapp/screens/home_container.dart:39:42) #3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:513:14) #4 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:568:30) #5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:120:24) #6 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9) #7 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7) #8 PrimaryPointerGestureReco<β¦>
I'm using the package right, but now working on the emulator.
openAppSetting will link to app setting page.
Is there a way to link to general setting page in iOS?
Thanksγ
App_Settings Version: 1.0.6+1
Flutter Verison:
[β] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G87, locale en-SG)
[β] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[β] Xcode - develop for iOS and macOS (Xcode 10.3)
[β] iOS tools - develop for iOS devices
[β] Android Studio (version 3.4)
[β] VS Code (version 1.36.1)
[β] Connected device (2 available)
Pod Version: 1.7.5
Run pod install
...
Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `app_settings` from `.symlinks/plugins/app_settings/ios`
[!] The `app_settings` pod failed to validate due to 1 error:
- WARN | license: Missing license type.
- ERROR | description: The description is empty.
- WARN | [iOS] keys: Missing primary key for `source` attribute. The acceptable ones are: `git, hg, http, svn`.
...
Suspect that in ios/app_settings.podspec
line 8, s.description = ''
is empty.
please tell if i'm missing something,
need a callback function after closing settings.
i was using location which is mandatory in my application, so i need to check location is turned on or not after closing the settings screen.
Xcode's output:
β³
=== BUILD TARGET firebase_messaging OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/x/Development/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/app_settings-1.0.6/ios/Classes/AppSettingsPlugin.m:2:9: fatal error: 'app_settings/app_settings-Swift.h' file not found
#import <app_settings/app_settings-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the precompiled application for the device.
Error launching application on Device.
Exited (sigterm)
.
I use a permission handler (Package permission_handler: ^5.0.1+1) where by It helps me to handle the errors when Allowing or not allowing permissions for accessing the camera in my flutter app. For the camera, I use the package image_picker: ^0.6.3+4. I have a Photo icon where by when clicking onto it, the function of the image picker is triggered. So After clicking on the icon, I get the Pop up if i want to allow the app to access the camera, And in the background, the AppSettings.openAppSettings() screen opens. After dismissing the dialog, I am in the AppSettings.openAppSettings() screen where by it gives me options to enable or disable the camera switch. If i switch on the camera to enable it, the app crashes and exits, and i get the Following error:
mach_msg_trap + 8 libsystem_kernel.dylib
mach_msg_trap: -> 0x1d61a88c4 <+8>: ret libsystem_kernel.dylib`mach_msg_overwrite_trap: 0x1d61a88c8 <+0>: mov x16, #-0x20 0x1d61a88cc <+4>: svc #0x80 0x1d61a88d0 <+8>: ret Target 0: (Runner) stopped.This is happening on my iOS device.
iOS Version : 14.0.1
Model Name : iPhone 8 Plus
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel master, 1.24.0-8.0.pre.194, on Mac OS X 10.15.4 19E287 darwin-x64, locale en-GB)
[β] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[β] Xcode - develop for iOS and macOS (Xcode 12.0.1)
[β] Android Studio (version 3.4)
[β] Android Studio (version 4.0)
[β] VS Code (version 1.51.1)
[β] Connected device (2 available)
β’ No issues found!
when using AppSettings.openDisplaySettings()
on a iphone simulator it doesn't open the correct settings page just takes you to the app settings page
I tried to implement it on a switch although it works but it always goes into a loop where it says the value is always false.
D/ViewRootImpl@6fe231bMainActivity: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x3 surface={valid=true 511763673088} changed=false
When trying to build the iOS app i get the following error:
/development/flutter/.pub-cache/hosted/pub.dartlang.org/app_settings-4.0.2/ios/Classes/AppSettingsPlugin.m:2:9: fatal error: 'app_settings/app_settings-Swift.h' file not found
#import <app_settings/app_settings-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
I am using app_settings 4.0.2 and have SWIFT 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.3.0
Hi,
Is there any particular reason why the compileSdkVersion is still 28?
Thanks!
final AndroidIntent intent = AndroidIntent(
action: 'android.settings.LOCATION_SOURCE_SETTINGS');
intent.launch();
I used this to get to the settings page on Android, it works fine, going to settings page, but when I press the back icon (Appbar leading Icon on Location Settings Page), it navigates to the Settings Screen of my phone, but usually, users don't want to see this. I guess, if it can be implemented in a way that clears the stack, and directly navigate me to the app screen.
I'm getting exception. I don't know what I am doing wrong here. API seems pretty straight forward.
Future<void> checkGpsConnection() async {
bool isLocationEnabled = await Geolocator().isLocationServiceEnabled();
if (!isLocationEnabled) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('No GPS'),
actions: <Widget>[
FlatButton(
child: Text('Open Settings'),
onPressed: () async => await AppSettings.openLocationSettings(),
)
],
),
);
}
}
E/flutter (27329): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method location on channel app_settings)
E/flutter (27329): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)
E/flutter (27329): <asynchronous suspension>
E/flutter (27329): #1 AppSettings.openLocationSettings (package:app_settings/app_settings.dart:15:14)
E/flutter (27329): <asynchronous suspension>
E/flutter (27329): #2 _MapsScreenState.checkGpsConnection.<anonymous closure>.<anonymous closure> (package:task_app/maps/maps_screen.dart:110:56)
E/flutter (27329): <asynchronous suspension>
E/flutter (27329): #3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:654:14)
E/flutter (27329): #4 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:729:32)
E/flutter (27329): #5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (27329): #6 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)
E/flutter (27329): #7 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:275:7)
E/flutter (27329): #8 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:455:9)
E/flutter (27329): #9 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:75:13)
E/flutter (27329): #10 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:102:11)
E/flutter (27329): #11 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
E/flutter (27329): #12 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (27329): #13 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (27329): #14 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (27329): #15 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (27329): #16 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (27329): #17 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (27329): #18 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (27329): #19 _invoke1 (dart:ui/hooks.dart:263:10)
E/flutter (27329): #20 _dispatchPointerDataPacket (dart:ui/hooks.dart:172:5)
Hello, and thank you for this awesome plugin.
Is it possible to add support for opening HotSpot settings screen?
Your plugin requires a few changes to the flutter default environment. It needs the swift bridging support and a change in the podfile to support framework. Please add this info and, ideally also instructions, on your install page. Without the changes the plugin does not work on ios. thank you.
Hello,
I would like to know if it is possible to add methods to be redirected on the main screen of settings for Android and also to be redirected on the language settings screen. It would be very interesting!
Thanks in advance.
I am not sure how the process is on android to get to the current subscriptions that the user is subscribed to, but on iOS is there a possible way to get to the subscription portion of settings?
It would be great if the Usage_stats settings is included.
is there any reason why min sdk version in example is changed to 21?
The current version of app_settings
allows for the system Wifi, Location, and Security menus to be accessed, but not the 'app' settings menu as experienced on iOS.
I will submit a PR to allow for this functionality on Android.
Hi guys,
My flutter application was running smooth. I have added app_settings: 4.0.1+1 package. And then I am getting the following error while the app is crashing.
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:116)
at com.example.appsettings.AppSettingsPlugin$Companion.registerWith(AppSettingsPlugin.kt:45)
at com.example.appsettings.AppSettingsPlugin.registerWith(Unknown Source:2)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:18)
at com.mazibook.MainActivity.configureFlutterEngine(MainActivity.java:11)
In GeneratePluginRegistrant.java file I have noticed the following lines which are causing to be crash.
see the following code.
@Keep public final class GeneratedPluginRegistrant { public static void registerWith(@NonNull FlutterEngine flutterEngine) { ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine); **com.example.appsettings.AppSettingsPlugin.registerWith(shimPluginRegistry.registrarFor("com.example.appsettings.AppSettingsPlugin"));** flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin()); flutterEngine.getPlugins().add(new io.flutter.plugins.connectivity.ConnectivityPlugin()); flutterEngine.getPlugins().add(new com.tahamalas.custom_switch_button.CustomSwitchButtonPlugin()); flutterEngine.getPlugins().add(new io.flutter.plugins.deviceinfo.DeviceInfoPlugin()); flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.core.FirebaseCorePlugin()); flutterEngine.getPlugins().add(new io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin()); io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin.registerWith(shimPluginRegistry.registrarFor("io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin")); flutterEngine.getPlugins().add(new io.flutter.plugins.imagepicker.ImagePickerPlugin()); notificationsenabled.notifications_enabled.NotificationsEnabledPlugin.registerWith(shimPluginRegistry.registrarFor("notificationsenabled.notifications_enabled.NotificationsEnabledPlugin")); } }
The problem seems to me is with package name. com.exmple.xxxxx.
Can you please let me know how can we resolve this issue.?
Thank you.
Asif.
Testing on Samsung Galaxy S7 Edge
When calling openBluetoothSettings the device opens app settings.
On emulator everything works fine (oreo 8.1)
app_settings: 3.0.0+1
Flutter doctor:
[β] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18362.657], locale pl-PL)
β’ Flutter version 1.12.13+hotfix.8 at C:\flutter
β’ Framework revision 0b8abb4724 (12 days ago), 2020-02-11 11:44:36 -0800
β’ Engine revision e1e6ced81d
β’ Dart version 2.7.0
[β] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
β’ Android SDK at C:\Users\Maciek\AppData\Local\Android\sdk
β’ Android NDK location not configured (optional; useful for native profiling support)
β’ Platform android-28, build-tools 28.0.3
β’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
β’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
β’ All Android licenses accepted.
[β] Android Studio (version 3.5)
β’ Android Studio at C:\Program Files\Android\Android Studio
β’ Flutter plugin version 41.0.2
β’ Dart plugin version 191.8593
β’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[β] Connected device (1 available)
β’ SM G935F β’ ce04160473d5d11d05 β’ android-arm64 β’ Android 8.0.0 (API 26)
Hi, I am using this plugin for my flutter app and had my min SDK set to 16. I noticed one of my beta testers kept crashing on startup with the error message below so I investigated. I found that I can reproduce this same error on any device with android sdk 19 and below (KitKat). In the meantime, I bumped my minsdk to 21 and everything works fine.
I may be doing something wrong but if anyone has any insight or has seen this before please let me know!
pubspec includes: app_settings: 1.0.6+2
in bundle.gradel ext.kotlin_version
is set to '1.3.21'
Let me know if nay other information would be useful. Thanks!
Fatal Exception: java.lang.NoClassDefFoundError: kotlin.jvm.internal.Intrinsics at
com.example.appsettings.AppSettingsPlugin$Companion.registerWith(AppSettingsPlugin.kt) at
com.example.appsettings.AppSettingsPlugin.registerWith(AppSettingsPlugin.kt) at
io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:33) at
com.CP.Savour.MainActivity.onCreate(MainActivity.java:11) at
android.app.Activity.performCreate(Activity.java:5372) at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104) at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257) at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) at
android.app.ActivityThread.access$700(ActivityThread.java:159) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) at
android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419) at
java.lang.reflect.Method.invokeNative(Method.java) at
java.lang.reflect.Method.invoke(Method.java:525) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) at
dalvik.system.NativeStart.main(NativeStart.java)
I was wondering if we could support using the new Settings.Panel API on Android Q and up?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app_settings:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/elias/Documents/GitHub/isontic-Education/build/app_settings/intermediates/res/merged/release/values/values.xml:236: error: resource android:attr/fontVariationSettings not found.
/Users/elias/Documents/GitHub/isontic-Education/build/app_settings/intermediates/res/merged/release/values/values.xml:237: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Launching lib/main.dart on Device in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: QP4YDP277L
Xcode build done. 5.5s
Failed to build iOS app
Error output from Xcode build:
β³
** BUILD FAILED **
Xcode's output:
β³
=== BUILD TARGET firebase_messaging OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/x/Development/Tools/flutter/.pub-cache/hosted/pub.dartlang.org/app_settings-1.0.6/ios/Classes/AppSettingsPlugin.m:2:9: fatal error: 'app_settings/app_settings-Swift.h' file not found
#import <app_settings/app_settings-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the precompiled application for the device.
Error launching application on Device.
Exited (sigterm)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.