Integrating the legacy Android Studio module
The App Embed Component for Android is typrically distributed as an AAR library file. If you have one of our legacy Android Studio modules then use this article to integrate it into your Android Studio project. If you have an AAR file then check out our article on integrating the AAR file into your project.
Step by Step
1. Unzip the App Embed Component
The App Embed Component download is a zip file that contains:
ZapparEmbed. The embed component itself - this is what will be integrated into your app.
ZapparEmbedTest. An example Android Studio project that demonstrates the integration.
The first step is to unzip the contents into a folder of your choosing.
2. Import the ZapparEmbed module into your Android Studio project
Open your app project in Android Studio. Click File > New > Import Module. Select the ZapparEmbed directory from the downloaded embed component, then click Finish.
After a few moments the ZapparEmbed module should appear in your project.
3. Add ZapparEmbed as a Module Dependency for your app's module
Right-click on your module's entry in the project navigator and select "Open Module Settings".
On the "Dependencies" tab click the "+" button at the bottom of the screen.
Select "Module Dependency" then choose ZapparEmbed.
4. Add your API key
Add the following tag inside the <application> block of your AndroidManifest.xml file:
<meta-data android:name="com.zappar.embed.API_KEY" android:value="your_api_key"/>
your_api_key with the key we supplied you for this application. Note that the API key is tied to the package name of your app (e.g. com.example.myapp). If you change your package name you will have to request a new API key from us at firstname.lastname@example.org.
5. At runtime, check that the device works with Zappar
While Zappar is supported on most devices running Android 2.3 and later, a small number of problematic devices are blacklisted. The embed component provides a function that can be used to ensure that the current device is compatible.
boolean isCompatible = ZapparEmbed.isCompatible(<<yourcontext>>);
6. Start the Zappar component
The component is launched using an Intent:
Intent i = new Intent(this, ZapparEmbed.getZapcodeClassForIntent()); startActivity(i);
This starts an Activity that manages the complete Zappar scanning/AR function.
Suggested Next Steps
The next article discusses the options for customizing the user interface of the Zappar component: