0

In my installed version of the app I want to have customised logic. It needs to use a completely different Activity. From the multi feature sample app provided by google i added inside the installed module a src folder with a new activity and some resource files. I also modified the manifest.xml inside the installed module so that it points to the activity i have added. no when i try to compile it, it seems that it won't include the new res folder files. Do i manually need to include them somewhere?

Also i do not understand why you need to tell the installed module to include the base project, since the other feature projects are already including them. And the weirdest part is that the base project itself is again including the features as well as the application. Its like a circle of inclusions. How confusing can it be.. Really wondering if I am the only one getting super confused by this strange architecture.

Gillis Haasnoot
  • 2,229
  • 1
  • 19
  • 23

2 Answers2

0

It is very difficult to determine what you are trying to achieve but AFAIK You can customize your logic by checking whether current instance is the instant or installable app by first addding this dependency in your feature module

api "com.google.android.instantapps:instantapps:1.0.0"

And in code you check for

isInstantApp(Context context)
Pinkesh Darji
  • 1,041
  • 10
  • 23
  • No thats not really what i wanted. I am few days further now. I start to understand the basics now. So what i did is adding a feature library which gets not included in the instant app, but gets included in the installable app. Somehow you still have to add it to the base feature (I still don't understand why you need to include features in the base feature anyway). And it seems to work. – Gillis Haasnoot Jul 22 '17 at 00:03
0

I have found a solution to my problem. First I should maybe clearify my usecase a bit better. Basically what i want is different activities for the instant app and installable app. They share a lot, but not everything. The installable APK does have more extended features where as the instant app is super light without things like sharing, login, settings. Also in some cases the installable app is having one activity for multiple screes/feature (with fragment replaces) where as the instant app has unique activities per screen/feature. I don't like to use isInstantApp all the time. I think it is cleaner to have separate logic with as much shared core logic as possible.

So my installable app is not feature, and it should have access to all dependencies and all feature logic.

I created the following modules:

  • installable (the apk version of the app)
  • instant (the instant app version of the app)
  • base_feature
  • feature_A
  • feature_B
  • installable_combined

now feature A and B have "base_feature" as their base project. "base_feature" have "feature_A" and "B" as its feature projects. "installable" is a normal "library" depending on "base_feature", "feature_a" and "feature_b"

So far it works great. Essentially i have separate code for instant and installable apps, but with most logic shared across both.

Gillis Haasnoot
  • 2,229
  • 1
  • 19
  • 23
  • I want to emulate your approach. But I do not understand what you put in installable_combined. Could you share its gradle and manifest? – JAW May 31 '18 at 14:41