Audience

PrintConnect has been widely utilized on Android devices to simplify the printer discovery and pairing process for apps that need to print labels or receipts on Zebra Link-OS printers. With PrintConnect, apps simply pass the variable data for the label and receipt to PrintConnect using the Android Intents. PrintConnect will merge the data with the template and send it to the printer.

With the release of Android 11 (API Level 30), additional security and privacy protection features have been added and enforced. One of them is the package visibility. Starting from Android 11, the app built with the targetSdkVerion of the API level 30 can no longer query the installed app on the system using getPackageInfo() method in PackageManager, unless the app declares the package ID that the app wants to query and interact with in its AndroidManifest.xml.

If your app uses the Android Intents to interact with PrintConnect, you need to add the following query statement in the AndroidManifest.xml if the targetSdkVersion is set to the API level 30. Otherwise, your app won’t be able to interact with PrintConnect through the intents on Android 11 devices.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.zebra.mytestapp">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.NFC" />

    <queries>
        <package android:name='com.zebra.printconnect' />
    </queries>

    <application

        ...

    </application>

</manifest>

The com.zebra.printconnect is the package ID of PrintConnect app. You can try this out with the TestConnect demo project that comes with the Link-OS SDK for Android release on an Android 11 device, by adding or removing the above query statement in the AndroidManifest.xml. The TestConnect demo project is in ../link_os_sdk/android/v2.14.5198/TestConnect folder.

However, the package visibility restriction on Android 11 devices would not apply if the targetSdkVersion is below the API level 30.

For more information, please refer to the following resources.

  1. Package visibility in Android 11
  2. Print Connect Application Note