Play Feature Delivery - Android
If you’re interested in partitioning your Android app into two distinct parts - a base app and an on-demand module that includes the Anyline SDK - this article is for you. We’ll delve into Play Feature Delivery (PFD), discuss the challenges associated with integrating PFD and the Anyline SDK, and provide a workaround to make PFD work, albeit with some limitations.
What is Play Feature Delivery?
PFD, or Play Feature Delivery (also known as Dynamic Feature Delivery), allows certain features of your app to be delivered conditionally or downloaded on demand.
This means that the 120MB the Anyline SDK needs will only be downloaded by a user who specifically requests the Anyline Scanning functionality.
What is the issue?
While separating the Anyline SDK into an on-demand module is effective, an issue arises when executing the functionality due to a collision between two factors.
Play Feature Delivery has a known limitation:
It isn't possible to use Android WebView in an activity that accesses resources or assets from an optional module.The Anyline SDK uses
WebView
with local resources in several cases (examples are the Visual Feedback implementation and theWaterMarkImage
).
PLEASE NOTE:
Further to the issue described above, there’s a crash when using PFD due to the Anyline dependency MLKit. However, this issue can be resolved by following a specific answer on StackOverflow.
The workaround, including the limitations
While Anyline works to fix this issue on the SDK-side, a workaround for the aforementioned limitation consists of a combination of three measures:
1 | The customer needs to be using a License Key without a Watermark, as a License Key containing a Watermark accesses local assets with the |
2 | “Live Preview” (the blue overlayed rectangles drawn over recognized characters, during a scan) would have to be lost. In this case the integrator needs to switch their PLEASE NOTE: Additional changes to the |
3 | The integrator fixes the MLKit Crash with their implementation (relevant Stackoverflow answer). |