Skip to content

Commit

Permalink
chore: add info to enable network permissions on android
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Nelson committed Jun 20, 2024
1 parent c64f758 commit d6f72be
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
13 changes: 13 additions & 0 deletions src/fragments/lib/project-setup/flutter/platform-setup/android.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,16 @@ android {
<Callout info>
If you would like to use a higher version of Gradle or Android Gradle plugin see the compatibility matrix [here](https://developer.android.com/build/releases/gradle-plugin#updating-gradle).
</Callout>

### Network Permissions for Release Builds

Flutter apps have access to make network requests by default in debug mode. This permission needs to be added when building in release mode. To do this, open `android/app/src/main/AndroidManifest.xml` and make the following addition.

```xml title="android/app/src/main/AndroidManifest.xml"
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
// highlight-start
<uses-permission android:name="android.permission.INTERNET"/>
// highlight-end
...
</manifest>
```
31 changes: 22 additions & 9 deletions src/pages/[platform]/start/platform-setup/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,31 @@ android {
If you would like to use a higher version of Gradle or Android Gradle plugin see the compatibility matrix [here](https://developer.android.com/build/releases/gradle-plugin#updating-gradle).
</Callout>

## Web
#### Network Permissions for Release Builds

Flutter apps have access to make network requests by default in debug mode. This permission needs to be added when building in release mode. To do this, open `android/app/src/main/AndroidManifest.xml` and make the following addition.

```xml title="android/app/src/main/AndroidManifest.xml"
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
// highlight-start
<uses-permission android:name="android.permission.INTERNET"/>
// highlight-end
...
</manifest>
```

### Web

There are no Amplify specific requirements or setup instructions when targeting web. You will need to use a browser supported by Flutter. See the following Flutter docs for more info:

- [Supported deployment platforms](https://docs.flutter.dev/reference/supported-platforms)
- [FAQ: Which web browsers are supported by Flutter?](https://docs.flutter.dev/development/platform-integration/web/faq#which-web-browsers-are-supported-by-flutter)

## macOS
### macOS

Amplify requires a minimum deployment target of 10.15 and Xcode 13.2 or higher when targeting macOS. Additionally, you will need to enable networking, keychain entitlements, and code signing.

### Update Minimum Version
#### Update Minimum Version

From your project root, navigate to the `macos/` directory and open the `Podfile` in a text editor of your choice. Update the target macOS platform to 10.15 or higher.

Expand All @@ -138,15 +151,15 @@ Select Runner, Project -> Runner and then the "Info" tab. Update "macOS Deployme

![Setting the macOS version to 10.15 or higher in the macOS Deployment Target tab of the Runner info section.](/images/project-setup/flutter/mac/project-min-deployment-version.png)

### Enable Network Calls
#### Enable Network Calls

Open your project in Xcode and select Runner, Targets -> Runner and then the "Signing and Capabilities" tab. Under "App Sandbox" select "Outgoing Connections (Client)".

![Selecting outgoing connections in the app sandbox section of the runner signing and capabilities tab.](/images/project-setup/flutter/mac/xcode-entitlements.png)

For more info on the Networking entitlement, see Apple's documentation on [com.apple.security.network.client](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_network_client).

### Enable Keychain Sharing
#### Enable Keychain Sharing

<Callout info>

Expand Down Expand Up @@ -175,17 +188,17 @@ Open your project in Xcode and select Runner, Targets -> Runner and then the "Si
![Team selector and Enable Development Signing button highlighted in the signing and capabilities section of the runner tab.](/images/project-setup/flutter/mac/enable-signing.png)


## Windows
### Windows

There are no Amplify specific requirements or setup instructions when targeting Windows. You will need to use a Windows version supported by Flutter. See the following Flutter docs for more info:

- [Supported deployment platforms](https://docs.flutter.dev/reference/supported-platforms)

## Linux
### Linux

Amplify Flutter depends on the [libsecret](https://wiki.gnome.org/Projects/Libsecret) library when targeting Linux.

### Local Development
#### Local Development

To run and debug an app that depends on Amplify Flutter, you must install `libsecret-1-dev`. Run the following commands to install `libsecret-1-dev`. this will also install dependencies of `libsecret-1-dev`, such as `libglib2.0-dev`.

Expand All @@ -202,7 +215,7 @@ sudo apt-get install -y libsecret-1-dev

{/* cSpell:enable */}

### Packaging Your App
#### Packaging Your App

To include the required dependencies when packaging your app with Snapcraft, include them in your `snapcraft.yaml` file. For more info, see [Flutter's documentation on releasing to the Snap Store](https://docs.flutter.dev/deployment/linux).

Expand Down

0 comments on commit d6f72be

Please sign in to comment.