Git Product home page Git Product logo

external_app_launcher's Introduction

Overview

A Flutter plugin which helps you to open another app from your app. The package asks you for four parameters out of which two are mandatory.

Getting Started

1. Add package to your project

Complete description to add this package to your project can be found here.

2. To setup native performance for the application in order to launch external apps

For opening apps in android

For opening an external app from your app in android, you need provide packageName of the app.

If the plugin finds the app in the device, it will be be launched. But if the the app is not installed in the device then it leads the user to playstore link of the app.

But if you don't want to redirect to playstore after installation then add the below script to AndroidManifest.xml file.

 <queries>
   <package android:name="net.pulsesecure.pulsesecure" /> // your android package name
 </queries>

// Above <application> tag

// Inside <intent-filter> add below existing <action> or <category>
<category android:name="android.intent.category.HOME"/> 
<category android:name="android.intent.category.DEFAULT"/>

Demo

For opening apps in ios

In iOS, for opening an external app from your app, you need to provide URLscheme of the target app.

To know more about URLScheme refer to this Link

If your deployment target is greater than or equal to 9, then you also need to update external app information in Info.plist.

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>pulsesecure</string> // url scheme name of the app
</array>

But unlike in Android, it will not navigate to store (appStore) if app is not found in the device.

For doing so you need to provide the iTunes link of the app.

Demo

Implementation

Apart from opening an external app, this package can also be used to check whether an app is installed in the device or not.

This can done by simply calling the function isAppInstalled

await LaunchApp.isAppInstalled(
  androidPackageName: 'net.pulsesecure.pulsesecure'
  iosUrlScheme: 'pulsesecure://'
);

This returns true and false based on the fact whether app is installed or not.

Code Illustration

import 'package:flutter/material.dart';
import 'package:external_app_launcher/external_app_launcher.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  Color containerColor = Colors.red;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Container(
            height: 50,
            width: 150,
            child: RaisedButton(
              color: Colors.blue,
              onPressed: () async {
                await LaunchApp.openApp(
                  androidPackageName: 'net.pulsesecure.pulsesecure',
                  iosUrlScheme: 'pulsesecure://',
                  appStoreLink: 'itms-apps://itunes.apple.com/us/app/pulse-secure/id945832041',
                  // openStore: false
                );

                // Enter the package name of the App you want to open and for iOS add the URLscheme to the Info.plist file.
                // The `openStore` argument decides whether the app redirects to PlayStore or AppStore.
                // For testing purpose you can enter com.instagram.android
              },
              child: Container(
                child: Center(
                  child: Text("Open",
                    textAlign: TextAlign.center,
                  ),
                ))),
          ),
        ),
      ),
    );
  }
}

external_app_launcher's People

Contributors

gayathri-ga avatar jaiswalshubham84 avatar ramilitani avatar sarika01 avatar t-unit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

external_app_launcher's Issues

A problem occurred configuring project ':external_app_launcher'.

A problem occurred configuring project ':external_app_launcher'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

When we upgrade the Gradle to 8.1.2 & compileSdkVersion to 34

When will Android Embedding Plugin version be available?

Running "flutter pub get" in ttukttak... 3.2s
The plugin external_app_launcher uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Process finished with exit code 0

.openApp() return 'something went wrong'

I'm creating a android launcher and therefore on the homescreen, it show apps to open. is works completely fine for the majority of apps, actualy, the only one i cant open is 'Pluto TV'.

On openApp() it returns 'something went wrong'

any idea what it could be?
i have no clue if it is something with gradle, or this app is different...

i've tried to make android intents/actions directly, but didnt managed to fully understand the comcept
may this pluto tv app opens diferently?

iOS: 'openUrl:' is deprecated

In the file LaunchexternalappPlugin.m lines 27 and 35 'openURL:' is used.

XCode 14.3 marks this as deprecated. "First deprecated in iOS 10.0"

Always redirecting to Google Play Store

Plugin is always opening Google Play Store even if the app is installed on the phone (Play Store page is the correct app with "Open" button, not "Install").

Debug console prints out:
I/flutter (11386): Redirecting to Google Play Store as the app is not present on the device

Tested on a OnePlus 8T under Android 11 / Oxygen OS 11.0.11.11

Directly open Google Play even using openStore: false

Hi, I'm having trouble using your package. Following your documentation, I have used:

await LaunchApp.isAppInstalled(androidPackageName: 'xxxxxxx');

I have used different apps to see if they were saved and in all cases the result has been false.

I'm sure I spelled the package name right because with the LaunchApp.openApp method, it opens the correct page on google play to install the app I'm trying to open with the package.

I have also tried to find packages like com.chrome.android, also being installed as the one I try to open.

app store link not working

this is my code

void launchApp() async {
var openAppResult = await LaunchApp.openApp(
androidPackageName: 'com.example.zoom_demo',
appStoreLink:
'https://play.google.com/store/apps/details?id=com.aceenggacademy.mobile',
);
}
when external app is not available in device it should redirect to store right ! but in my code it is redirecting to playstore and still loading like circular progress indicator not showing app store link play store page .

This is my androidmanifestxml file

Screenshot from 2022-08-10 16-21-25

can u please help me to find this app store link problem?

Android build warning

Based on the warning message I got while building for Android, this package uses deprecated API.

Note: /Users/behnam/.pub-cache/hosted/pub.dev/external_app_launcher-3.1.0/android/src/main/java/com/example/launchexternalapp/LaunchexternalappPlugin.java uses or overrides a deprecated API.

How to run a specific url in chrome

There is no problem running the chrom app.

await LaunchApp.openApp(
      androidPackageName: 'com.android.chrome',
    );

However, is it possible to open a specific page by passing a url other than the default page of Chrome?

Always redirecting to iOS App Store

I have defined random scheme in Project 1 (left side), called it 'dashboss'
and tried to use this plugin to check for being installed and launch it.

image

But I am unable to launch the app and it keeps saying Redirecting to AppStore as the app is not present on the device

What could be the issue?

Application not launched when not in background

Hi.

I have a problem for launching an app when not int background.

We use awsomeNotification to customize some notification.
When a notification is received, we also simulate a phone call.
Then, when user accept the phone call we launch the app.

When the application is in background, its works, but when the application is not launched, its not working :(.

Have you got any solution .

Thanks for your feedback.

Add iOS privacy manifests

Issue

By Apple's Privacy manifest guidelines,
some action will be required such as adding an empty privacy manifests file even if you are not collecting anything.

Maybe it is good adding an empty privacy manifests file even if you are not collecting anything.

Apple's document: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
See flutter/flutter#131940 for more context.

Solution suggestion

Add privacy manifests file (PrivacyInfo.xcprivacy) according to libraries privacy usage.

The following is an example of an empty privacy manifests file if this library is not collecting anything.
device_info_plus/ios/PrivacyInfo.xcprivacy

Open external app with intent data (Android + IOS)

intent://payment#Intent;action=ch.twint.action.TWINT_UOF_REGISTRATION;scheme=twint;S.code=T23LU9K;S.startingOrigin=EXTERNAL_WEB_BROWSER;S.browser_fallback_url=;end

this one is the example, if this feature add then it will help a lot to share data to app while opening it.

Safari launch

Safari does not have specific iosUrlScheme, is there a way to launch it?
I do not need to open any url or search view, so "x-web-search://" does not work for me.

isAppInstalled() doesn't detect that Zoom is already installed.

Description: I'm trying to use LaunchApp.isAppInstalled() to see if Zoom is already installed, and prompt the user to install it if not already. However, regardless of whether Zoom is installed, isAppInstalled() is always returning false.

// Example Code, copy/paste from my app code:
bool isInstalled = await LaunchApp.isAppInstalled(
androidPackageName: 'us.zoom.videomeetings',
iosUrlScheme: 'zoomus://',
);
if (isInstalled == false) {
return showError("Install Zoom to attend this meeting.");
}
// Launch zoom meeting

Expected behavior: When Zoom is already installed, this code should not interrupt the flow of the program.

Actual behavior: Even though Zoom is already installed, the end user sees an error "Install Zoom to attend this meeting."

Environment: The system I'm testing with (my phone) is a 2023 Moto Razr plus with all updates applied. I've tried compiling on OSX Sonoma (with all updates applied) and Fedora Core 39 (Also, with all updates applied)

Open app by link

I wonder whether it's possilbe to support opening the app using intent, e.g. I want to open Telegram channel by tg:// link like it's shown here. Probably, this PR may be related.

At the moment a have the following code snippet relying on url_launcher as a workaround:

Future<void> launchApp({
  required String androidPackageName,
  required String iosUrlScheme,
  required String appStoreLink,
  required String? link,
}) async {
  if (link == null || !await LaunchApp.isAppInstalled(
    androidPackageName: androidPackageName,
    iosUrlScheme: iosUrlScheme,
  )) {
    await LaunchApp.openApp(
      androidPackageName: androidPackageName,
      iosUrlScheme: iosUrlScheme,
      appStoreLink: appStoreLink,
      openStore: true,
    );
    return;
  }

  if (!await canLaunch(link)) {
    return;
  }
  await launch(link);
}

external_app_launcher: uses or overrides a deprecated API.

Note: C:\Users\vrica\AppData\Local\Pub\Cache\hosted\pub.dev\external_app_launcher-4.0.0\android\src\main\java\com\example\launchexternalapp\LaunchexternalappPlugin.java uses or overrides a deprecated API.

Flutter 3.19.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ba39319843 (7 weeks ago) • 2024-03-07 15:22:21 -0600
Engine • revision 2e4ba9c6fb
Tools • Dart 3.3.1 • DevTools 2.31.1

Please! What I have to do?

No support for Huawei

When openApp API is called it opens PlayStore webpage rather than Huawei App Gallery. Please fix that.

iOS not returning bool.

Only on iOS this occur.

When checking isAppInstalled, it will return null when it is not installed, and will return 1 when it is installed. While on android it will return true or false. A bit of a pain to have to distinguish between platforms the return value. Unsure if this is happening to anyone else. I understand the return type is dynamic.

Open external app without UrlScheme

Hello,
I am trying to open an external app from my Flutter app on iOS.
The external app does not provide URLSchemes in its info.plist.

The idea is just to open the app without deep linking.

How can I do that?
thanks

Unhandled Exception: MissingPluginException(No implementation found for method openApp on channel launch_vpn)

i got this error, when try to use method openApp().

/flutter (14668): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method openApp on channel launch_vpn)
E/flutter (14668): #0 MethodChannel._invokeMethod
platform_channel.dart:308
E/flutter (14668):
E/flutter (14668): #1 LaunchApp.openApp
external_app_launcher.dart:46
E/flutter (14668):
E/flutter (14668): #2 _HomePageState.mainMenu2.
homepage.dart:251
E/flutter (14668):
E/flutter (14668):

what should i do?

What is the use of "LaunchVpnPlugin.java" class?

This is not an issue more like a query. I was studying the internals of this library and I needed to make some changes. I found two classes : LaunchVpnPlugin.java and LaunchExternalappPlugin.java . I made changes to LaunchExternalappPlugin.java and got my desired output, I was wondering why LaunchVpnPlugin.java exists?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.