Android Instant Apps and using the LInks app

It looks like Android Instant Apps is now supported on Android 5.0 or later. However, links to applications (which I realized that depends on instant applications) are only supported in version 6.0 or later. I searched the Internet but could not find a clear answer to this.

In general, it seems that we want to support instant applications, use application links to navigate between actions in different functional modules, but also in most cases it is necessary to use these modules to build an installed apk that works on versions below 5.0
Does this mean What code should check the API level and use different approaches depending on the version (for example, calling startActivitywith explicit intent, if <5.0)?

This is the information I found in the Instant Applications Documentation :

And your instant and installed versions of your application should implement the Android App Links application, introduced in Android 6.0 . Application links provide the primary mechanism for connecting URLs to discrete actions in your application.

and

an instant application cannot launch an action in another function directly; instead, it should request a URL corresponding to another different destination login function.

and then from https://developer.android.com/topic/instant-apps/index.html

Android Instant Apps supports the latest Android devices from Android 5.0 (API level 21) via Android O

+4
source share
1 answer

Android Android- ( , ). API . , startActivity . , , Instant App.

( ), .

, Android Instant Apps Android 5.0 . , App Links ( , Instant Apps ) 6.0

, . ( Google Play Services Instant Apps Android 8.0) , , Instant App, .

, API (, startActivity < 5.0)

, 100% , ( , "chooser" ) , (, , ). , , , .

interface Navigation {
   void startActivityFromModuleA();
   void startActivityFromModuleB();
}

class InstallableAppNavigation implements Navigation {
   public void startActivityFromModuleA() {
       // explicit intent
       Intent intent = new Intent(context, ActivityFromModuleA.class);
       context.startActivity(intent);
   }
}

class InstantAppNavigation implements Navigation {
   public void startActivityFromModuleA() {
       // implicit intent
       Intent intent = new Intent(Intent.ACTION_VIEW,  
               Uri.parse("https://your.app.com/moduleA/smth"));
       context.startActivity(intent);
   }
}
+3

Source: https://habr.com/ru/post/1687480/


All Articles