Giter Site home page Giter Site logo

yash-garg / appcheck Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 19.0 489 KB

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

Home Page: https://pub.dev/packages/appcheck

License: MIT License

Kotlin 28.49% Dart 41.97% Objective-C 4.42% Swift 11.09% Ruby 14.03%
kotlin flutter flutter-package android ios dart swift method-channel

appcheck's Introduction

Flutter AppCheck 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 is inspired by the plugin Discontinued AppAvailability Plugin.

NOTE - Everything has been mostly rewritten in Kotlin and updated to latest null-safety standards.

Installation

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

Methods available

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

Permissions

If you want to use the getInstalledApps() function, you need the QUERY_ALL_PACKAGES permission.

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

If you only want to check certain apps and you know the packageName, add them via queries in AndroidManifest.xml.

<queries>
   <package android:name="com.google.android.apps.maps"/>
</queries>

Check out Example.

Screenshots

appcheck's People

Contributors

berkayoez avatar dammel avatar imgbot[bot] avatar imsamgarg avatar muhd-ameen avatar yash-garg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

appcheck's Issues

AppCheck.checkAvailability(package) not working. Throwing Unhandled Exception!

My Code (placed on button):

onTap: () async {
  const package =
      "org.codeclickers.universalconverter";
  if (Platform.isAndroid) {
    await AppCheck.checkAvailability(
            package)
        .then(
      (app) => debugPrint(app.toString()),
    );
  }
}

Here is the error thrown in terminal:

E/getAppPackageInfo (org.codeclickers.universalconverter)( 5580): org.codeclickers.universalconverter
E/flutter ( 5580): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(400, App not found org.codeclickers.universalconverter, null, null)
E/flutter ( 5580): #0      StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:653
E/flutter ( 5580): #1      MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:296
E/flutter ( 5580): <asynchronous suspension>
E/flutter ( 5580): #2      AppCheck.checkAvailability
package:appcheck/appcheck.dart:46
E/flutter ( 5580): <asynchronous suspension>
E/flutter ( 5580): #3      _OtherTabState.build.<anonymous closure>.<anonymous closure>
package:tools/tabs/other.dart:68
E/flutter ( 5580): <asynchronous suspension>
E/flutter ( 5580):

how to get ios package name

because for ios use package name like ("calshow://") so how i can get this type package name for different apps . i only check app is installed or not in ios device

Running example code, with exception thrown out

Nothing changed, just copy, build & run on Stimulator iOS (iPhone 14), and this exception been thrown out

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method checkAvailability on channel dev.yashgarg/appcheck)
#0      MethodChannel._invokeMethod
platform_channel.dart:313
<asynchronous suspension>
#1      AppCheck.checkAvailability
appcheck.dart:59
<asynchronous suspension>
#2      _AppCheckExampleState.getApps
app_checker.dart:52
<asynchronous suspension>

Remove QUERY_ALL_PACKAGES permission

From 12.07.2022 apps from the PlayStore may be removed , which use the permission QUERY_ALL_PACKAGES without explanation.
Since I only want to check if a certain app is installed, I don't really need this permission.

If you know the packageName you can enter the following in the AndroidManifest.xml and it works without the QUERY_ALL_PACKAGES permission.

<queries>
        <package android:name="com._._"/>
        <package android:name="com.google.android.apps.maps"/>
</queries>

If you want to check all installed apps, you have to add the permission QUERY_ALL_PACKAGES.
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

But every user of this package should be responsible for the permissions himself.

Could you please check this?

#3

Problems to recognize APP in IOS

Good I am having a problem and is that in iOS, when you check if there is for example the following application "com.myapp.testing" always fails or does not recognize the packageName. But instead when I take the example you provide for iOS. It does open the calendar and recognizes the applications but when you specify a specific package name it does not seem to recognize or locate the application installed on the emulator. I am using the following examples and none of them work correctly do you know how to solve it?

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.