The phenomenon of description

When you open a quick application from the app market and click Back, the system adds a desktop icon and a pop-up window appears only once. But when you use Deeplink to open the jump page and click Back, the added desktop icon will pop up once and then flash again.

Problem analysis

If you use Deeplink or web hop to access quick applications on the live network, a pop-up box will appear once when you create a desktop icon. An analysis of the Deeplink redirect page shows that the onBackPress function has been overwritten.

This. entryDirect is the parameter carried when Deeplink jumps.

OnBackPress is triggered when the user clicks the return button. If true is returned, the page applies its own return logic, false is returned, and if false is not returned, the page uses the default return logic.

}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} The Finish event is also triggered. After the Finish event is heard, the app Center will pop-up the user to create the icon, resulting in two pop-ups.

The solution

Change the interface onBackPress function code to no longer use the default button return logic after calling this.app.exit() to exit the application.

Suggestions and Conclusions

When the page needs to use the onBackPress function to process its own logic, it must return true at the end of the function. Otherwise, the system will return logic by default after processing the onBackPress code, which may lead to exceptions.

The original link: developer.huawei.com/consumer/cn…

Original author: Mayism