An open API service indexing awesome lists of open source software.

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.

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");
}
```