Getting Started - Android

The Android Capture client aims to make it as simple as possible to add scanning functionality into an Android application. It hides the complexity of the Android activity lifecycle by hooking into it. If you use a non-standard application architecture or just want more explicit control over the client and it’s lifecycle, please refer to the Java docs and create and manage an instance of :java:type:`CaptureClient` directly.

SDK Installation

The SDK is released as a NuGet package.

You can find the current release on NuGet by searching for SocketMobile.Capture

The Capture SDK NuGet depends on JSON NuGet from Newsoft that will get installed as well.

An application using the Socket Capture SDK needs to be registered in order to retrieve an AppKey that is required by the Capture API. You can register for an app key on the Socket Mobile Developer portal. Note you will have to log in to create an App Key.

Add package name

Use the same pacakge name that was previous used to register the application.

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="..."  package="YOUR_PACKAGE_NAME_HERE">
</manifest>

Targeting Android 28+?

Apps that target Android 28+ must also enable cleartext traffic to localhost. If you do not already have a network security configuration file, you will need to create one.

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="..." >
  <application android:label="..."
      android:networkSecurityConfig="@xml/network_security_config"
      ...>

  </application>
</manifest>
res/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
  <base-config cleartextTrafficPermitted="false" />
  <domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="false">localhost</domain>
    <domain includeSubdomains="false">127.0.0.1</domain>
  </domain-config>
</network-security-config>