问题
anyone knows any workaround? We are closing the application by calling this line of code Titanium.Android.currentActivity.finish() when the user tap the back button(device back). Though the application will close completely, if the user tried to re-launch the app using the recent apps(task bar), the application will freeze that affects device performance.
I created a new app, tested it and was able to replicate the issue.
Anyone knows a work-around?
Steps:
1. Create an app
2. Create a window in index.xml
3. add event listener and open the window on your index.js
$.container.addEventListener('androidback', function(){
Titanium.Android.currentActivity.finish();
});
$.container.open();
OS Info:
回答1:
I solved the problem as I described in another answer Appcelerator app doesn't restart (Android)
Add the following property in tiapp.xml
<property name="ti.android.root.reappears.restart" type="bool">true</property>
in the root of the <ti:app>
tag
回答2:
The issue was resolved using SDK 6.0.0. Just need to re-compile existing modules to make it compatible with the said SDK version.
来源:https://stackoverflow.com/questions/40990418/app-will-freeze-if-re-launch-from-the-task-bar-after-closing-it-using-titanium-a