首页 > 解决方案 > 如何打开现有的 android 应用程序并使用颤振向其发送数据

问题描述

你好我想打开一个现有的应用程序(我也做了)我可以使用这个包flutter_appavailability从我的flutter应用程序启动应用程序:^0.0.21我想要的是从flutter应用程序发送数据然后到我的应用程序开张了

我想要的是将数据样本“测试数据”发送到我正在打开的应用程序中的一个文本框。

下面是我当前打开现有应用程序的代码。

   home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin flutter_appavailability app'),
        ),
        body: ListView.builder(
          itemCount: installedApps == null ? 0 : installedApps.length,
          itemBuilder: (context, index) {
            return ListTile(
              title: Text(installedApps[index]["app_name"]),
              trailing: IconButton(
                  icon: const Icon(Icons.open_in_new),
                  onPressed: () {
                    Scaffold.of(context).hideCurrentSnackBar();
                    AppAvailability.launchApp(installedApps[index]["package_name"]).then((_) {
                      print("App ${installedApps[index]["app_name"]} launched!");
                    }).catchError((err) {
                      Scaffold.of(context).showSnackBar(SnackBar(
                          content: Text("App ${installedApps[index]["app_name"]} not found!")
                      ));
                      print(err);
                    });
                  }
              ),
            );
          },
        ),
      ),

标签: javaandroidandroid-studioflutterdart

解决方案


推荐阅读