Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Instant App: How to create URL addressable modules?

Tags:

Google updated their documentation about instant apps recently: Prepare your app

Most of the points are clear except 3. Refactor your app, if necessary.

They suggest for retail modules like browse, search, item detail, and check out.

Question: How do I split up the app into modules which are fully functional & URL addressable?

I do see here several issues:

  • if we use libraries like dagger, butterknife, ... all modules would be dependent on other modules
  • if our modules contain (views) as required, how should a transition to another view (from another module) be implemented without importing this module?

Can somebody shed light into the dark? Thanks!

like image 881
Fahim Avatar asked Feb 07 '17 13:02

Fahim


1 Answers

Proper modules separation required by Instant Apps can be easily done using the following steps:

  1. Create a shared module which will contain code and resources which should be shared across feature modules.
  2. Create several feature modules for each major feature (in the example provided by Google: browse, search, item detail, and checkout). These modules can depend on the shared module created in p.1, but they should know nothing about each other.
  3. To start an activity from different module make target activity URL-addressable, and start it via implicit intent. Google suggests to use App Links for that.
  4. To build your regular Android app, create an application module which depends on feature modules.
  5. Once Google releases its Android InstantApp SDK to the public, you can build your Instant Apps (one per feature).
like image 166
Idolon Avatar answered Oct 02 '22 18:10

Idolon