Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit eaf6bc7

Browse files
ashutoshkmrMichael Klimushyn
authored andcommitted
[android_intent] Add action_application_details_settings (flutter#2045)
This PR includes addition of "action_application_details_settings" action to open App info settings. I was working on Handling denied permissions in one of my projects where i wanted to redirect user to app info settings to enable permissions in case the permissions were denied permanently (that is clicked 'Do not ask again checkbox')
1 parent 1bb42f5 commit eaf6bc7

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

packages/android_intent/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.3+1
2+
3+
* Added "action_application_details_settings" action to open application info settings .
4+
15
## 0.3.3
26

37
* Added "flags" option to call intent.addFlags(int) in native.

packages/android_intent/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ for it in the plugin and use an action constant to refer to it. For instance:
2929

3030
`'action_location_source_settings'` translates to `android.settings.LOCATION_SOURCE_SETTINGS`
3131

32+
`'action_application_details_settings'` translates to `android.settings.ACTION_APPLICATION_DETAILS_SETTINGS`
33+
34+
```dart
35+
if (platform.isAndroid) {
36+
final AndroidIntent intent = AndroidIntent(
37+
action: 'action_application_details_settings',
38+
data: 'package:com.example.app', // replace com.example.app with your applicationId
39+
);
40+
await intent.launch();
41+
}
42+
43+
```
44+
3245
Feel free to add support for additional Android intents.
3346

3447
The Dart values supported for the arguments parameter, and their corresponding

packages/android_intent/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ private String convertAction(String action) {
4646
return Settings.ACTION_SETTINGS;
4747
case "action_location_source_settings":
4848
return Settings.ACTION_LOCATION_SOURCE_SETTINGS;
49+
case "action_application_details_settings":
50+
return Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
4951
default:
5052
return action;
5153
}

packages/android_intent/example/lib/main.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ class ExplicitIntentsWidget extends StatelessWidget {
142142
intent.launch();
143143
}
144144

145+
void _openApplicationDetails() {
146+
final AndroidIntent intent = const AndroidIntent(
147+
action: 'action_application_details_settings',
148+
data: 'package:io.flutter.plugins.androidintentexample',
149+
);
150+
intent.launch();
151+
}
152+
145153
@override
146154
Widget build(BuildContext context) {
147155
return Scaffold(
@@ -186,6 +194,12 @@ class ExplicitIntentsWidget extends StatelessWidget {
186194
'Tap here to open Location Settings Configuration',
187195
),
188196
onPressed: _openLocationSettingsConfiguration,
197+
),
198+
RaisedButton(
199+
child: const Text(
200+
'Tap here to open Application Details',
201+
),
202+
onPressed: _openApplicationDetails,
189203
)
190204
],
191205
),

packages/android_intent/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: android_intent
22
description: Flutter plugin for launching Android Intents. Not supported on iOS.
33
author: Flutter Team <[email protected]>
44
homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent
5-
version: 0.3.3
5+
version: 0.3.3+1
66

77
flutter:
88
plugin:

0 commit comments

Comments
 (0)