App Utils

Pub Package Pub Package

Application plugin which provides utility functions for Android and iOS.

Installation

Android

In android you can either declare QUERY_ALL_PACKAGES permission (to provide broader app package visibility) or can declare packages inside

Note -> Using QUERY_ALL_PACKAGES permission may cause your app to be rejected on playstore if your app doesn't have any core functional which is
required broad package visibility (eg antivirus app that needs limit visibility to scan all apps in your device). If your app does not require QUERY_ALL_PACKAGES permission as a core functionality in your app, consider using the

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

<queries>
 <package android:name="com.whatsapp.businessapp"/> 
 <package android:name="in.techbyvishesh.myapp"/>
</queries>   

iOS

In Ios, for opening the target app from your app, you need to provide the URL scheme of the target app.

To know more about URLScheme in iOS, please visit below link.
https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app

In your deployment target is greater than or equal to 9 then also need to update another app information in your Info.plist.

<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string> // url scheme
</array>

List of supported functions

  1. launchApp (Android and iOS) :
    It opens target application from provided package name in Android and URLScheme in iOS.

  2. getInstalledApps (Android) :
    It returns a list of the installed applications from your devices.

  3. canLaunchApp (Android & iOS) :
    It checks application is launchable or not.

  4. getCurrentDeviceInfo (Android and iOS) :
    It returns current device information.

  5. getCurrentAppInfo (Android and iOS) :
    It returns your application information.

  6. readLaunchedData (Android and iOS) :
    It allows us to read sender application data. In android, it reads data from activity intent but in iOS, it reads data from URL Scheme.

  7. openDeviceSettings (Android and iOS) :
    • It allows us to open settings page from your application.
    • In Android, it supports multiple settings option.
    • In iOS, due to apple restriction, it only supports the main settings page.For more info, please visit here.

Upcoming features

  1. requestDeviceAuth : Open the device unlock screen on Android and iOS.
  2. playAudio: Allows you to play audio on your device.
  3. openDeviceSensor: Allows you to open device sensors.

Bugs or Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull request are also welcome.

Libraries

app_utils
models
settings