android_intent_plus: ^5.0.2
只支持Android,既能指定packageName,也能传入url,可以跳转到指定APP的某个页面,不适用iOS
void openApp() {
  AndroidIntent intent = AndroidIntent(
    action: 'com.example.dashan_board.ACTION', // 替换为您需要的动作
    package: 'com.example.dashan_board', // 替换为目标应用程序的包名
    componentName: 'com.example.dashan_board.BlankActivity', // 替换为目标应用程序的活动组件名称
  );
  intent.launch();
}

 使用安卓的intent

建立通道,使用flutter进行调用

    @SuppressLint("LongLogTag")  //用于告诉编译器忽略指定代码段的特定警告或lint检查
    private void launchApp() {
        // 创建一个新的 Intent 对象
        Intent  intent = new Intent();
        // 设置 Intent 的 ComponentName,用于指定启动的目标 Activity
        // 参数1:目标应用的包名
        // 参数2:目标 Activity 的类名
        intent.setComponent(new ComponentName("com.example.dashan_board", "com.example.dashan_board.BlankActivity"));
        // 设置 Intent 的 Action,用于标识此 Intent 的目的或动作
        // 参数:自定义的动作标识
        intent.setAction("com.example.dashan_board.ACTION");
        startActivity(intent);
    }

 

 

 

posted on 2024-04-22 11:13  鲤斌  阅读(189)  评论(0编辑  收藏  举报