@capgo/capacitor-intent-launcher 8.3.3 → 8.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,6 +37,224 @@ npx cap sync
37
37
 
38
38
  Works out of the box. No additional configuration required.
39
39
 
40
+ ### Opening Android Settings Screens
41
+
42
+ The plugin provides access to all Android system settings screens through the `ActivityAction` enum. Here are common examples:
43
+
44
+ ```typescript
45
+ import { IntentLauncher, ActivityAction } from '@capgo/capacitor-intent-launcher';
46
+
47
+ // Open main settings screen
48
+ await IntentLauncher.startActivityAsync({
49
+ action: ActivityAction.SETTINGS
50
+ });
51
+
52
+ // Open WiFi settings
53
+ await IntentLauncher.startActivityAsync({
54
+ action: ActivityAction.WIFI_SETTINGS
55
+ });
56
+
57
+ // Open Bluetooth settings
58
+ await IntentLauncher.startActivityAsync({
59
+ action: ActivityAction.BLUETOOTH_SETTINGS
60
+ });
61
+
62
+ // Open Location settings
63
+ await IntentLauncher.startActivityAsync({
64
+ action: ActivityAction.LOCATION_SOURCE_SETTINGS
65
+ });
66
+
67
+ // Open Display settings
68
+ await IntentLauncher.startActivityAsync({
69
+ action: ActivityAction.DISPLAY_SETTINGS
70
+ });
71
+
72
+ // Open Sound settings
73
+ await IntentLauncher.startActivityAsync({
74
+ action: ActivityAction.SOUND_SETTINGS
75
+ });
76
+
77
+ // Open Notification settings
78
+ await IntentLauncher.startActivityAsync({
79
+ action: ActivityAction.NOTIFICATION_SETTINGS
80
+ });
81
+ ```
82
+
83
+ ### Opening App-Specific Settings
84
+
85
+ You can open settings for a specific app by passing the package name:
86
+
87
+ ```typescript
88
+ // Open your app's settings page
89
+ await IntentLauncher.startActivityAsync({
90
+ action: ActivityAction.APPLICATION_DETAILS_SETTINGS,
91
+ data: 'package:com.yourapp.package'
92
+ });
93
+
94
+ // Open notification settings for your app
95
+ await IntentLauncher.startActivityAsync({
96
+ action: ActivityAction.APP_NOTIFICATION_SETTINGS,
97
+ extra: {
98
+ 'android.provider.extra.APP_PACKAGE': 'com.yourapp.package'
99
+ }
100
+ });
101
+ ```
102
+
103
+ ### Launching Other Apps
104
+
105
+ ```typescript
106
+ // Open an app by package name
107
+ await IntentLauncher.openApplication({
108
+ packageName: 'com.google.android.gm' // Gmail
109
+ });
110
+
111
+ // Get an app's icon
112
+ const { icon } = await IntentLauncher.getApplicationIconAsync({
113
+ packageName: 'com.google.android.gm'
114
+ });
115
+ // icon is a base64-encoded PNG: 'data:image/png;base64,...'
116
+ ```
117
+
118
+ ### Advanced Intent Options
119
+
120
+ You can pass additional options like extras, flags, and MIME types:
121
+
122
+ ```typescript
123
+ // Open a content picker
124
+ await IntentLauncher.startActivityAsync({
125
+ action: ActivityAction.GET_CONTENT,
126
+ type: 'image/*', // MIME type
127
+ category: 'android.intent.category.OPENABLE'
128
+ });
129
+
130
+ // Open a URL in the browser
131
+ await IntentLauncher.startActivityAsync({
132
+ action: ActivityAction.VIEW,
133
+ data: 'https://example.com'
134
+ });
135
+
136
+ // Send text to another app
137
+ await IntentLauncher.startActivityAsync({
138
+ action: ActivityAction.SEND,
139
+ type: 'text/plain',
140
+ extra: {
141
+ 'android.intent.extra.TEXT': 'Hello World!'
142
+ }
143
+ });
144
+
145
+ // Make a phone call (requires CALL_PHONE permission)
146
+ await IntentLauncher.startActivityAsync({
147
+ action: ActivityAction.CALL,
148
+ data: 'tel:+1234567890'
149
+ });
150
+
151
+ // Open the dialer with a number (no permission required)
152
+ await IntentLauncher.startActivityAsync({
153
+ action: ActivityAction.DIAL,
154
+ data: 'tel:+1234567890'
155
+ });
156
+ ```
157
+
158
+ ### Handling Activity Results
159
+
160
+ The `startActivityAsync` method returns a result with status information:
161
+
162
+ ```typescript
163
+ const result = await IntentLauncher.startActivityAsync({
164
+ action: ActivityAction.LOCATION_SOURCE_SETTINGS
165
+ });
166
+
167
+ console.log('Result code:', result.resultCode);
168
+ // resultCode: -1 = Success, 0 = Canceled, 1+ = Custom user codes
169
+
170
+ if (result.data) {
171
+ console.log('Data URI:', result.data);
172
+ }
173
+
174
+ if (result.extra) {
175
+ console.log('Extra data:', result.extra);
176
+ }
177
+ ```
178
+
179
+ ### Common Use Cases
180
+
181
+ **Guide users to enable permissions:**
182
+
183
+ ```typescript
184
+ // Location permission
185
+ await IntentLauncher.startActivityAsync({
186
+ action: ActivityAction.LOCATION_SOURCE_SETTINGS
187
+ });
188
+
189
+ // Battery optimization settings
190
+ await IntentLauncher.startActivityAsync({
191
+ action: ActivityAction.IGNORE_BATTERY_OPTIMIZATION_SETTINGS
192
+ });
193
+
194
+ // Overlay permission (draw over other apps)
195
+ await IntentLauncher.startActivityAsync({
196
+ action: ActivityAction.MANAGE_OVERLAY_PERMISSION,
197
+ data: 'package:com.yourapp.package'
198
+ });
199
+ ```
200
+
201
+ **Network settings:**
202
+
203
+ ```typescript
204
+ // WiFi settings
205
+ await IntentLauncher.startActivityAsync({
206
+ action: ActivityAction.WIFI_SETTINGS
207
+ });
208
+
209
+ // Mobile data settings
210
+ await IntentLauncher.startActivityAsync({
211
+ action: ActivityAction.DATA_USAGE_SETTINGS
212
+ });
213
+
214
+ // Airplane mode settings
215
+ await IntentLauncher.startActivityAsync({
216
+ action: ActivityAction.AIRPLANE_MODE_SETTINGS
217
+ });
218
+ ```
219
+
220
+ **Security settings:**
221
+
222
+ ```typescript
223
+ // Biometric enrollment
224
+ await IntentLauncher.startActivityAsync({
225
+ action: ActivityAction.BIOMETRIC_ENROLL
226
+ });
227
+
228
+ // Fingerprint settings
229
+ await IntentLauncher.startActivityAsync({
230
+ action: ActivityAction.FINGERPRINT_SETTINGS
231
+ });
232
+
233
+ // Security settings
234
+ await IntentLauncher.startActivityAsync({
235
+ action: ActivityAction.SECURITY_SETTINGS
236
+ });
237
+ ```
238
+
239
+ ### Android Version Compatibility
240
+
241
+ Some settings actions are only available on specific Android versions. The plugin includes platform version information in the `ActivityAction` enum comments (e.g., `@platform Android 12+`). If you use an action that's not available on the device's Android version, the intent may fail or fall back to a general settings screen.
242
+
243
+ ### Error Handling
244
+
245
+ Always wrap intent calls in try-catch blocks:
246
+
247
+ ```typescript
248
+ try {
249
+ await IntentLauncher.startActivityAsync({
250
+ action: ActivityAction.WIFI_SETTINGS
251
+ });
252
+ } catch (error) {
253
+ console.error('Failed to open settings:', error);
254
+ // Handle error - e.g., show a message to the user
255
+ }
256
+ ```
257
+
40
258
  ## iOS
41
259
 
42
260
  Works out of the box. Use the `openIOSSettings()` method to open iOS settings screens.
@@ -26,7 +26,7 @@ import org.json.JSONObject;
26
26
  @CapacitorPlugin(name = "IntentLauncher")
27
27
  public class IntentLauncherPlugin extends Plugin {
28
28
 
29
- private final String pluginVersion = "8.3.3";
29
+ private final String pluginVersion = "8.3.4";
30
30
 
31
31
  @PluginMethod
32
32
  public void startActivityAsync(PluginCall call) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-intent-launcher",
3
- "version": "8.3.3",
3
+ "version": "8.3.4",
4
4
  "description": "Capacitor plugin to launch Android intents and open system settings screens on Android and iOS.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",