All Projects → pichillilorenzo → Flutter_appavailability

pichillilorenzo / Flutter_appavailability

Licence: mit
A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.

Programming Languages

swift
15916 projects
dart
5743 projects

Projects that are alternatives of or similar to Flutter appavailability

Flutter inappwebview
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
Stars: ✭ 1,259 (+1898.41%)
Mutual labels:  plugin, flutter-plugin
Flutter statusbarcolor
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.
Stars: ✭ 203 (+222.22%)
Mutual labels:  plugin, flutter-plugin
Plugins
go-flutter implementations for popular Flutter plugins
Stars: ✭ 125 (+98.41%)
Mutual labels:  plugin, flutter-plugin
Plugins
Plugins for Flutter maintained by the Flutter team
Stars: ✭ 14,956 (+23639.68%)
Mutual labels:  plugin, flutter-plugin
Analog clock
⌚️Analog Clock widget for Flutter ⏰
Stars: ✭ 136 (+115.87%)
Mutual labels:  plugin, flutter-plugin
Flutter Woocommerce Api
WooCommerce API in Flutter, connect and start developing with the available endpoints like get products, create orders and more.
Stars: ✭ 31 (-50.79%)
Mutual labels:  plugin, flutter-plugin
Chartjs Plugin Rough
Chart.js plugin to create charts with a hand-drawn, sketchy, appearance
Stars: ✭ 59 (-6.35%)
Mutual labels:  plugin
Flutter svg
SVG parsing, rendering, and widget library for Flutter
Stars: ✭ 1,113 (+1666.67%)
Mutual labels:  flutter-plugin
Serverauth
An advanced authentication plugin for PocketMine-MP
Stars: ✭ 58 (-7.94%)
Mutual labels:  plugin
Matlab Editor Plugin
Extends features for the matlab editor, Bookmarks, FileStructure, Clipboard stack
Stars: ✭ 58 (-7.94%)
Mutual labels:  plugin
Flutter native ads
Show AdMob Native Ads use PlatformView
Stars: ✭ 63 (+0%)
Mutual labels:  flutter-plugin
Webconsole
Spigot plugin to manage your server remotely using a web interface
Stars: ✭ 62 (-1.59%)
Mutual labels:  plugin
Krystal
🐱‍🏍 TiddlyWiki5 plugin - Horizontal Story River
Stars: ✭ 60 (-4.76%)
Mutual labels:  plugin
Cameo
CMIO DAL plugin explorer
Stars: ✭ 59 (-6.35%)
Mutual labels:  plugin
Winhellounlock
KeePass 2 plugin to automatically unlock databases with Windows Hello
Stars: ✭ 61 (-3.17%)
Mutual labels:  plugin
Flutterradioplayer
Flutter Radio Player, A Plugin to handle streaming audio without a hassle
Stars: ✭ 59 (-6.35%)
Mutual labels:  flutter-plugin
Bootstrap For Vue
Use https://bootstrap-vue.js.org instead.
Stars: ✭ 62 (-1.59%)
Mutual labels:  plugin
Fish Docker Compose
Fish shell completions for docker-compose
Stars: ✭ 58 (-7.94%)
Mutual labels:  plugin
Quickcolor
Quickly apply fills from the global or document color palettes to selected elements - 🎨
Stars: ✭ 59 (-6.35%)
Mutual labels:  plugin
Httpie Http2
Experimental HTTP/2 plugin for HTTPie
Stars: ✭ 61 (-3.17%)
Mutual labels:  plugin

Flutter AppAvailability Plugin

Pub

A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.

This plugin was inspired by the plugin AppAvailability for Cordova.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Installation

First, add flutter_appavailability as a dependency in your pubspec.yaml file.

Methods available

  • checkAvailability(String uri)
  • getInstalledApps() (only for Android)
  • isAppEnabled(String uri) (only for Android)
  • launchApp(String uri)

See the docs.

Example

Here is a small example flutter app displaying a list of installed apps that you can launch.

import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';

import 'package:flutter_appavailability/flutter_appavailability.dart';

void main() => runApp(new MyApp());

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

class _MyAppState extends State<MyApp> {

  List<Map<String, String>> installedApps;
  List<Map<String, String>> iOSApps = [
    {
      "app_name": "Calendar",
      "package_name": "calshow://"
    },
    {
      "app_name": "Facebook",
      "package_name": "fb://"
    },
    {
      "app_name": "Whatsapp",
      "package_name": "whatsapp://"
    }
  ];


  @override
  void initState() {
    super.initState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> getApps() async {
    List<Map<String, String>> _installedApps;

    if (Platform.isAndroid) {

      _installedApps = await AppAvailability.getInstalledApps();

      print(await AppAvailability.checkAvailability("com.android.chrome"));
      // Returns: Map<String, String>{app_name: Chrome, package_name: com.android.chrome, versionCode: null, version_name: 55.0.2883.91}

      print(await AppAvailability.isAppEnabled("com.android.chrome"));
      // Returns: true

    }
    else if (Platform.isIOS) {
      // iOS doesn't allow to get installed apps.
      _installedApps = iOSApps;

      print(await AppAvailability.checkAvailability("calshow://"));
      // Returns: Map<String, String>{app_name: , package_name: calshow://, versionCode: , version_name: }

    }

    setState(() {
      installedApps = _installedApps;
    });

  }

  @override
  Widget build(BuildContext context) {
    if (installedApps == null)
      getApps();

    return MaterialApp(
      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);
                  });
                }
              ),
            );
          },
        ),
      ),
    );
  }
}

Android: screenshot_1536780581

iOS: simulator screen shot - iphone x - 2018-09-12 at 21 27 05

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].