Skip to content

Commit 9eb1938

Browse files
author
Capacitor+ Bot
committed
chore: sync upstream PR ionic-team#8256 from @sahilsharda
2 parents 2b487bf + 385e552 commit 9eb1938

File tree

4 files changed

+162
-3
lines changed

4 files changed

+162
-3
lines changed

android/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Capacitor Android
2+
3+
The Capacitor Android package provides the Android runtime for Capacitor applications. It allows you to build and deploy your web application to Android devices and emulators.
4+
5+
## Installation
6+
7+
Install the android package:
8+
9+
```bash
10+
npm install @capacitor/android
11+
```
12+
13+
Add the Android platform to your Capacitor project:
14+
15+
```bash
16+
npx cap add android
17+
```
18+
19+
## Usage
20+
21+
### Opening the Android Project
22+
23+
To open your Android project in Android Studio:
24+
25+
```bash
26+
npx cap open android
27+
```
28+
29+
### Running on Device/Emulator
30+
31+
You can run your app directly from the command line:
32+
33+
```bash
34+
npx cap run android
35+
```
36+
37+
## Configuration
38+
39+
The Android configuration is handled primarily through `capacitor.config.ts` and the native `AndroidManifest.xml`.
40+
41+
### Permissions
42+
43+
Add permissions to your `android/app/src/main/AndroidManifest.xml` file as needed by your plugins.
44+
45+
```xml
46+
<uses-permission android:name="android.permission.CAMERA" />
47+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
48+
```
49+
50+
## Version Compatibility
51+
52+
| Capacitor Version | Android Version | Gradle Version |
53+
|------------------|-----------------|----------------|
54+
| v6.x | Android 14+ | 8.2+ |
55+
| v5.x | Android 13+ | 8.0+ |
56+
57+
## Local Development
58+
59+
If you're contributing to the Capacitor Android runtime:
60+
61+
1. Clone the repository
62+
2. Open `android/` in Android Studio
63+
3. Let Gradle sync and build the project
64+
65+
## Resources
66+
67+
- [Android Deployment Guide](https://capacitorjs.com/docs/android/deploy)
68+
- [Troubleshooting Android](https://capacitorjs.com/docs/android/troubleshooting)
69+
- [Capacitor Documentation](https://capacitorjs.com/docs)
70+
71+
## License
72+
73+
- [MIT](https://github.com/ionic-team/capacitor/blob/HEAD/LICENSE)

core/native-bridge.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,9 @@ const convertBody = async (
125125
const CAPACITOR_HTTP_INTERCEPTOR = '/_capacitor_http_interceptor_';
126126
const CAPACITOR_HTTP_INTERCEPTOR_URL_PARAM = 'u';
127127

128-
// TODO: export as Cap function
129128
const isRelativeOrProxyUrl = (url: string | undefined): boolean =>
130129
!url || !(url.startsWith('http:') || url.startsWith('https:')) || url.indexOf(CAPACITOR_HTTP_INTERCEPTOR) > -1;
131130

132-
// TODO: export as Cap function
133131
const createProxyUrl = (url: string, win: WindowCapacitor): string => {
134132
if (isRelativeOrProxyUrl(url)) return url;
135133
const bridgeUrl = new URL(win.Capacitor?.getServerUrl() ?? '');
@@ -237,6 +235,9 @@ const initBridge = (w: any): void => {
237235
return false;
238236
};
239237

238+
cap.isRelativeOrProxyUrl = isRelativeOrProxyUrl;
239+
cap.createProxyUrl = createProxyUrl;
240+
240241
win.Capacitor = cap;
241242
};
242243

@@ -604,7 +605,7 @@ const initBridge = (w: any): void => {
604605

605606
// XHR patch
606607
interface PatchedXMLHttpRequestConstructor extends XMLHttpRequest {
607-
new (): XMLHttpRequest;
608+
new(): XMLHttpRequest;
608609
}
609610

610611
window.XMLHttpRequest = function () {

core/src/definitions-internal.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ export interface CapacitorInstance extends CapacitorGlobal {
8989
* Low-level API used by the native bridge.
9090
*/
9191
withPlugin?: (pluginName: string, fn: (...args: any[]) => any) => void;
92+
93+
/**
94+
* Checks if a URL is relative or a proxy URL.
95+
*/
96+
isRelativeOrProxyUrl: (url: string | undefined) => boolean;
97+
98+
/**
99+
* Creates a proxy URL for the given URL.
100+
*/
101+
createProxyUrl: (url: string, win: WindowCapacitor) => string;
92102
}
93103

94104
export interface MessageCallData {

ios/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Capacitor iOS
2+
3+
The Capacitor iOS package provides the iOS runtime for Capacitor applications. It allows you to build and deploy your web application to iOS devices and simulators.
4+
5+
## Installation
6+
7+
Install the ios package:
8+
9+
```bash
10+
npm install @capacitor/ios
11+
```
12+
13+
Add the iOS platform to your Capacitor project:
14+
15+
```bash
16+
npx cap add ios
17+
```
18+
19+
## Usage
20+
21+
### Opening the iOS Project
22+
23+
To open your iOS project in Xcode:
24+
25+
```bash
26+
npx cap open ios
27+
```
28+
29+
### Running on Simulator/Device
30+
31+
You can run your app directly from the command line:
32+
33+
```bash
34+
npx cap run ios
35+
```
36+
37+
## Configuration
38+
39+
The iOS configuration is handled primarily through `capacitor.config.ts` and the native `Info.plist`.
40+
41+
### Permissions
42+
43+
Add usage descriptions to your `ios/App/App/Info.plist` file as needed by your plugins.
44+
45+
```xml
46+
<key>NSCameraUsageDescription</key>
47+
<string>We need access to the camera to take photos</string>
48+
<key>NSLocationWhenInUseUsageDescription</key>
49+
<string>We need your location to show local content</string>
50+
```
51+
52+
## Version Compatibility
53+
54+
| Capacitor Version | iOS Version | Xcode Version |
55+
|------------------|-------------|---------------|
56+
| v6.x | iOS 13+ | 15.0+ |
57+
| v5.x | iOS 13+ | 14.1+ |
58+
59+
## Local Development
60+
61+
If you're contributing to the Capacitor iOS runtime:
62+
63+
1. Clone the repository
64+
2. Run `npm install` in the root
65+
3. Open `ios/Capacitor/Capacitor.xcworkspace` in Xcode
66+
67+
## Resources
68+
69+
- [iOS Deployment Guide](https://capacitorjs.com/docs/ios/deploy)
70+
- [Troubleshooting iOS](https://capacitorjs.com/docs/ios/troubleshooting)
71+
- [Capacitor Documentation](https://capacitorjs.com/docs)
72+
73+
## License
74+
75+
- [MIT](https://github.com/ionic-team/capacitor/blob/HEAD/LICENSE)

0 commit comments

Comments
 (0)