https://github.com/best-flutter/linker
A plugin for flutter to link with other app.
https://github.com/best-flutter/linker
flutter flutter-plugin
Last synced: about 1 year ago
JSON representation
A plugin for flutter to link with other app.
- Host: GitHub
- URL: https://github.com/best-flutter/linker
- Owner: best-flutter
- License: mit
- Created: 2018-09-06T10:09:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-06T23:57:45.000Z (over 6 years ago)
- Last Synced: 2025-03-28T03:51:13.293Z (about 1 year ago)
- Topics: flutter, flutter-plugin
- Language: Dart
- Homepage:
- Size: 146 KB
- Stars: 21
- Watchers: 1
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# linker
A flutter plugin to link with other app or system function.
## Getting Started
add
```
linker: 0.0.2
```
to your pubspec.yaml, and run `flutter packages get`
## Usage
### Android
Use action
```
try {
ActivityResult result = await Linker.startActivityForResult(
new Intent.fromAction("android.settings.SETTINGS"), 0);
print(result);
} on PlatformException catch (e) {
print("Open failed $e");
}
```
Open google map
```
try {
await Linker.startActivity(new Intent.fromAction(
"android.intent.action.VIEW",
uri: Uri.parse(
"http://ditu.google.cn/maps?hl=zh&mrt=loc&q=31.1198723,121.1099877(上海青浦大街100号)"),
));
} on PlatformException catch (e) {
print("Open failed $e");
}
```
Open QQ
```
try {
await Linker.startActivity(new Intent.fromAction(Intent.ACTION_VIEW,
uri: Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=123456")));
} on PlatformException catch (e) {
print("Open failed $e");
}
```
Open Wechat
```
try {
await Linker.startActivity(new Intent.callApp( packageName: "com.tencent.mm",className: "com.tencent.mm.ui.LauncherUI"));
} on PlatformException catch (e) {
print("Open failed $e");
}
```
### ios
Open wechat
```
try {
await Linker.openURL("weixin://");
} on PlatformException catch (e) {
print("Open failed $e");
}
```
Open Settings
```
try {
await Linker.openURL("App-Prefs:root");
} on PlatformException catch (e) {
print("Open failed $e");
}
```
Call 10086
```
try {
await Linker.openURL("tel:10086");
} on PlatformException catch (e) {
print("Open failed $e");
}
```