乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Android Instant Apps和App LInks的使用

       印度阿三17 2019-06-22

      現(xiàn)在看來Android 5.0或更高版本支持Android Instant Apps.但是,App Links(我理解Instant Apps依賴)僅在6.0或更高版本中受支持.我在網(wǎng)上搜索過但無法找到明確的答案.

      一般來說,我們希望支持即時應(yīng)用程序,使用應(yīng)用程序鏈接在不同功能模塊中的活動之間導(dǎo)航,但在大多數(shù)情況下還需要使用這些模塊來構(gòu)建適用于5.0以下版本的可安裝apk
      這是否意味著代碼需要檢查API級別并根據(jù)版本使用不同的方法(例如,如果< 5.0則調(diào)用具有顯式意圖的startActivity)? 這是我在Instant Apps documentation中找到的信息:

      Both your instant and installable versions of your app must implement
      the Android App Links feature introduced in Android 6.0. App Links
      provide the primary mechanism for connecting URLs to discrete
      activities within your app.

      an instant app cannot launch an activity in another feature directly;
      instead, it must request the URL address that corresponds to the other
      other feature’s entry-point activity.

      然后從https://developer./topic/instant-apps/index.html開始

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

      解決方法:

      Android應(yīng)用鏈接只是為Android系統(tǒng)提供了一種方式,可以將您的http深層鏈接與您的應(yīng)用程序進行唯一關(guān)聯(lián)(無需顯示消歧對話框,供用戶選擇打開鏈接的應(yīng)用程序).它沒有為您提供任何新的API來啟動活動.因此,您無論如何都需要調(diào)用startActivity.如果要打開屬于另一個即時應(yīng)用程序功能模塊的活動,則只需使用隱式意圖.

      對于同一功能模塊內(nèi)部的導(dǎo)航(或者如果您的Instant App僅包含one base feature),可以自由使用明確的意圖.

      It looks like right now that Android Instant Apps are supported in
      Android 5.0 or later. However, App Links (which I understood that
      Instant Apps depend on) are only supported in 6.0 or later

      是的,這是真的.但是,即時應(yīng)用程序主管(由Google Play服務(wù)內(nèi)部安裝并用于在8.0之前在Android上運行即時應(yīng)用程序)將確保注冊到已驗證的即時應(yīng)用程序域的應(yīng)用程序鏈接將直接轉(zhuǎn)發(fā)到您的即時應(yīng)用程序.

      Does this mean that code needs to check the API level and use
      different approaches depending on version (e.g calling startActivity
      if < 5.0)

      是的,如果你想100%確定你的用戶不會在你的應(yīng)用程序的活動之間瀏覽時顯示消歧(也就是“選擇器”)對話框like this(并且很可能你想要防止這種奇怪的用戶體驗).如果使用依賴注入,則可以在應(yīng)用程序中使用用于導(dǎo)航的界面,然后使用可安裝和即時應(yīng)用程序的不同實現(xiàn).

      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./moduleA/smth"));
             context.startActivity(intent);
         }
         …
      }

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多