Android Instant APP

来源:互联网 发布:淘宝 处罚考试 编辑:程序博客网 时间:2024/05/19 19:58

Copy from  Android Developer, Android Instant App

Instant Apps is in an Early Access Program with a limited set of developers. We would encourage interested developers to begin brainstorming the optimal user experience to build your instant app experience around. The best instant app experiences are focused on helping the user accomplish a task quickly (e.g. watching a video or making a purchase). You can also start getting your app ready for Instant Apps by working through this list of steps. Many of these are considered best practices for Android apps generally.

1. Remove any unneeded bulk from your app

Get rid of any unknown/unused permissions, unused components, unneeded third-party dependencies, and libraries. Removing these items can dramatically reduce the size of your app and improve performance significantly. See information onReducing APK size.

2. Support Android App Links

Android Instant Apps automatically handles web links using the Android App Links feature introduced in Android 6.0. As such, App Links are required in order to support URL-based navigation of Android Instant Apps. To get started with App Links, see the information on Handling App Links and the guide to implementing Digital Asset Links.

Android Instant Apps uses URLs for all navigation. When a user taps a link to your instant app, they go to a specific activity within your app. If the link fails or the user taps the link on an unsupported device, the browser opens and shows your website. Also, an activity cannot launch another activity directly within an instant app; rather, it must request the URL address that corresponds to that activity.

3. Refactor your app, if necessary

Android instant apps need to be structured into URL-addressable modules that are under 4MB in size. For apps that are larger than 4MB, developers would need to refactor the app into smaller modules that can be downloaded and run independently in response to URL navigation. Developers are free to choose what to include in each module, but our recommendation is to isolate distinct user flows into different modules. This gives a fast and responsive experience within a flow and additional modules are downloaded only when the user switches flows. For example, when building a retail experience, you might separate your app into four modules: browse, search, item detail, and checkout to allow the user to download modules as needed throughout the purchase flow.

4. Implement runtime permissions from Android 6.0

Android Instant Apps use runtime permissions, introduced in Android 6.0. The Android Instant Apps framework ensures that these features work correctly on earlier versions of Android as well. As such, please make sure your app is targeting Android 6.0+ and implement runtime permissions. To learn how to update your app to use Android 6.0 permissions, see the information onRequesting Permissions at Runtime.

5. Implement Smart Lock for Passwords if your app authenticates users

For instant apps that include login, developers must integrate Smart Lock for Passwords. This allows users to quickly and securely sign in by using the credentials they have saved, as well as for users to remain signed in across app visits. To learn more about Smart Lock, please see information here.

6. Identify unsupported features

User expectations may vary for apps that are installed vs. apps accessed via URL, so certain functionality available to installed apps is not available to instant apps. Developers using any of the below functionality would need to refactor their app to move unsupported features to a separate library module that can be included only in their installed app.

Instant apps cannot:

  • Run on the device without users being aware. Foreground services are available. Instant apps can only be started through activities that support App Links, so services, content providers or broadcast receivers won't be able to start your app. Push notifications are currently not supported in instant apps.
  • Access external storage on the device. However, instant apps can temporarily use internal storage private to the app.
  • Discover or interact directly with the list of installed apps on the device (e.g. via explicit intents).
  • Receive broadcasts from the system or other installed apps, or use GCM. In the future, instant apps may support a limited set of broadcasts while the app is running.
  • Access device identifiers that (1) persist longer than the instant app and (2) are not resettable by the user (e.g. Settings Secure Android ID (SSAID), Build Serial, Mac Addresses, IMEI, IMSI). NOTE: developers will have access to the Advertising ID.
  • Change device settings (e.g. change the user's wallpaper).
0 0
原创粉丝点击