88[ discord-image ] : https://img.shields.io/discord/884679008049037342.svg
99[ discord-url ] : https://discord.gg/zPa6EZ2jqb
1010
11- This plugin allows Flutter ** desktop ** apps to register and handle custom protocols (i.e. deep linking).
11+ This plugin allows Flutter apps to register and handle custom protocols (i.e. deep linking).
1212
1313---
1414
@@ -26,6 +26,8 @@ English | [简体中文](./README-ZH.md)
2626 - [ Quick Start] ( #quick-start )
2727 - [ Installation] ( #installation )
2828 - [ Usage] ( #usage )
29+ - [ Android] ( #android )
30+ - [ iOS] ( #ios )
2931 - [ macOS] ( #macos )
3032 - [ Windows] ( #windows )
3133 - [ Listening events] ( #listening-events )
@@ -56,7 +58,7 @@ Add this to your package's pubspec.yaml file:
5658
5759``` yaml
5860dependencies :
59- protocol_handler : ^0.1.1
61+ protocol_handler : ^0.1.2
6062` ` `
6163
6264Or
@@ -71,6 +73,124 @@ dependencies:
7173
7274### Usage
7375
76+ ##### Android
77+
78+ Change the file ` android/app/src/main/AndroidManifest.xml` as follows:
79+
80+ ` ` ` diff
81+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
82+ package="org.leanflutter.plugins.protocol_handler_example">
83+
84+ <application
85+ android:name="${applicationName}"
86+ android:icon="@mipmap/ic_launcher"
87+ android:label="protocol_handler_example">
88+ <activity
89+ android:name=".MainActivity"
90+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
91+ android:exported="true"
92+ android:hardwareAccelerated="true"
93+ android:launchMode="singleTop"
94+ android:theme="@style/LaunchTheme"
95+ android:windowSoftInputMode="adjustResize">
96+ <!-- Specifies an Android theme to apply to this Activity as soon as
97+ the Android process has started. This theme is visible to the user
98+ while the Flutter UI initializes. After that, this theme continues
99+ to determine the Window background behind the Flutter UI. -->
100+ <meta-data
101+ android:name="io.flutter.embedding.android.NormalTheme"
102+ android:resource="@style/NormalTheme" />
103+
104+ <intent-filter>
105+ <action android:name="android.intent.action.MAIN" />
106+ <category android:name="android.intent.category.LAUNCHER" />
107+ </intent-filter>
108+ + <intent-filter>
109+ + <action android:name="android.intent.action.VIEW" />
110+ +
111+ + <category android:name="android.intent.category.DEFAULT" />
112+ + <category android:name="android.intent.category.BROWSABLE" />
113+ + <!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
114+ + <data android:scheme="myprotocol" />
115+ + </intent-filter>
116+ </activity>
117+ <!-- Don't delete the meta-data below.
118+ This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
119+ <meta-data
120+ android:name="flutterEmbedding"
121+ android:value="2" />
122+ </application>
123+ </manifest>
124+ ` ` `
125+
126+ # #### iOS
127+
128+ Change the file `ios/Runner/Info.plist` as follows :
129+
130+ ` ` ` diff
131+ <?xml version="1.0" encoding="UTF-8"?>
132+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
133+ <plist version="1.0">
134+ <dict>
135+ <key>CFBundleDevelopmentRegion</key>
136+ <string>$(DEVELOPMENT_LANGUAGE)</string>
137+ <key>CFBundleDisplayName</key>
138+ <string>Protocol Handler</string>
139+ <key>CFBundleExecutable</key>
140+ <string>$(EXECUTABLE_NAME)</string>
141+ <key>CFBundleIdentifier</key>
142+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
143+ <key>CFBundleInfoDictionaryVersion</key>
144+ <string>6.0</string>
145+ <key>CFBundleName</key>
146+ <string>protocol_handler_example</string>
147+ <key>CFBundlePackageType</key>
148+ <string>APPL</string>
149+ <key>CFBundleShortVersionString</key>
150+ <string>$(FLUTTER_BUILD_NAME)</string>
151+ <key>CFBundleSignature</key>
152+ <string>????</string>
153+ <key>CFBundleVersion</key>
154+ <string>$(FLUTTER_BUILD_NUMBER)</string>
155+ <key>LSRequiresIPhoneOS</key>
156+ <true/>
157+ <key>UILaunchStoryboardName</key>
158+ <string>LaunchScreen</string>
159+ <key>UIMainStoryboardFile</key>
160+ <string>Main</string>
161+ + <key>CFBundleURLTypes</key>
162+ + <array>
163+ + <dict>
164+ + <key>CFBundleTypeRole</key>
165+ + <string>Editor</string>
166+ + <key>CFBundleURLName</key>
167+ + <string></string>
168+ + <key>CFBundleURLSchemes</key>
169+ + <array>
170+ + <string>myprotocol</string>
171+ + </array>
172+ + </dict>
173+ + </array>
174+ <key>UISupportedInterfaceOrientations</key>
175+ <array>
176+ <string>UIInterfaceOrientationPortrait</string>
177+ <string>UIInterfaceOrientationLandscapeLeft</string>
178+ <string>UIInterfaceOrientationLandscapeRight</string>
179+ </array>
180+ <key>UISupportedInterfaceOrientations~ipad</key>
181+ <array>
182+ <string>UIInterfaceOrientationPortrait</string>
183+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
184+ <string>UIInterfaceOrientationLandscapeLeft</string>
185+ <string>UIInterfaceOrientationLandscapeRight</string>
186+ </array>
187+ <key>UIViewControllerBasedStatusBarAppearance</key>
188+ <false/>
189+ </dict>
190+ </plist>
191+
192+ ` ` `
193+
74194# #### macOS
75195
76196Change the file `macos/Runner/Info.plist` as follows :
0 commit comments