Environmental access

  • Handling of environmental conflicts caused by dependency issues
  • Configure one-click switching of the production or test environment

At the beginning, it was very troublesome to switch the mPaaS environment every time. The configuration file involved in the environment switch also needed to be completely modified, otherwise the small program could not be opened. Due to the complexity of the configuration file is prone to unexpected exceptions caused by omissions, a Gradle script was written to deal with the configuration problem based on this problem. Later, the official document also improved this part of Gradle code. We also optimized this part of our code according to the official documents on the basis of the original. The configuration file involves the following modification points:

1, 00000001 _0. 0.0.1. Amr; 2, the Ant - mpaas - XXXXXXX - test - Android. Config. 3, custom_config. Json; 4, h5_json. Json; 5, MPNebula. LoadOfflineNebula () configuration offline package information.Copy the code

Optimize the timeliness of updates on the home page

1. Home page structure

Home page according to the characteristics and documentation of mPaaS. We finally use the embedded view to access the home page; But the problem is that the update is not timely; The following is a detailed analysis of the abnormal scenarios caused by this delay.

2. Scenario analysis

Our medical APP (hereinafter referred to as APP) has high real-time requirements on the homepage. However, according to the documents and work orders:

Normally, the update mechanism can be triggered only after 30 minutes. However, the secondary update mechanism only updates local offline package data and does not provide a refresh mechanism. This has lead to appear this kind of scenario, A user in the case of open the APP, our home page background update released the new hand right now, and will not trigger within 30 min cooldown mPaaS update mechanism, this leads to user needs in the next trigger updates, open the application opened the application, then maybe you can see we have the latest home page. Later after and mPaaS classmates found, summarizes some “no matter how to trigger the update mechanism and successfully download the latest version of the offline package to the local, can will have been loaded page refresh operation, the refresh operation will only in the download load can see last download good offline package update the contents of the”; The move should also be official for user experience. Still, we’re looking forward to a more flexible API that will give developers more room to maneuver

3. Solution – Temporary (to be optimized by the official)

Some e-commerce apps have observed real-time processing of the page, that is, the background releases page update -> page popup prompts users whether to update -> users confirm and then update the page; It is also a balance between real-time data and user experience; Of course, we have also made various attempts to update our APP home page. The following are some attempts (of course, some “invalid” schemes may be due to errors in our operation mode, for reference only) :

  • The reload method using apWebView -> is invalid
  • Synchronous or asynchronous create inline view again, replace to home -> invalid
  • Launch page callMPNebula. UpdateAllApp ()Then launch the home page in a successful callback ->effectiveHowever, depending on callback, affected by network environment and other factors, the APP startup time will be increased. (I have communicated with the customer service of mPaaS about this plan, and mPaaS said it was feasible, but did not suggest it. So we didn’t.)
  • This scheme works. This is the scheme temporarily adopted by our APP (we are looking forward to official API support in the later stage).
Graph TD A [APP launch to the home page] -- > | check mPaaS distribute the latest version of the background | C compared with local version (if there's any update) C - > is | | D [asynchronous update download the offline package to local and prompt the user to update the home page] -- > C whether | | E [no] operation D - > update | | to confirm F [update destroyed fragments and reload the home page to achieve] D - > | cancel update | G [no] operationCopy the code

H5 container and offline package related issues

Custom API

  • Method names cannot conflict with the built-in API
  • Note when the front-end initializes the mPaaS environment

Applets stack related issues

Page stack limit

  • The applets specify a maximum of 10 page stacks, otherwise exceptions will occur, see my. NavigateTo with routing FAQ

The small program is abnormal. Procedure

Note: The following small programs are the same small program (ID: XXXXX1)

  • 【 applet page A】->【 native Activity page B】->【 applet page C】 this stack structure will appear 【 applet page C】 can not open the situation
  • Kill [small program page A] before opening [small program page C], then you can open [small program page C], but the data display of [small program page C] may be abnormal.

To be continued…

instructions

  1. Personal access experience records for reference only, if there are mistakes welcome to correct, thank you!!
  2. This article is based on the baseline version of mPaaS10.1.60.14Small program base library version1.14.1