PhoneGap Android 2.2.0带来的新体验
对我最有用的是,
1、启动画面正式被支持
以前不知道设置多长时间好,因为不同的手机性能差异很大。
现在不用担心,可以设置个比较长的时间,比如10000ms即10秒,程序完成启动后,通过api来关闭启动画面。
这样更科学。
2、JS性能显著提高,最明显的表现是程序启动时间大约缩短了一半(phonegap+jquery+iscroll)
其他方面对我的应用影响不大。
如了解详情,请看原文。
1. FileTransfer API changes
- Added support for the onprogress event to get progress events for a FileTransfer operation
- Added the abort function to cancel a FileTransfer operation
See the API doc .
2. Graduated the Globalization plugin to core
This plugin was previously in the phonegap-plugins repo (BB WebWorks 5, iOS, Android). The globalization object obtains information and performs operations specific to the user’s locale and timezone.
See the API doc .
3. Splashscreen API
The Splashscreen API is now formally documented for iOS and Android.
4. Android JavaScript to Java bridge improvements
- The callback server is gone.
- Uses events to specify when a result it ready.
- Up to 25 times faster.
Read issue CB-638 for more information.
5. Partial support for video tag
We've been able to shim in support for the video tag. See my earlier blog post for more details.
6. Hardware acceleration is enabled by default
When you run bin/create to make a new PhoneGap Android project then android:hardwareAccelerated is set to true by default on the main activity.
See Android docs for an explanation of hardware acceleration .
See Android docs for an explanation of hardware acceleration .
7. useBrowserHistory now defaults to true
We've deprecated the current way that history is handled in Android apps in favour of the default way it is handled in the web view. To go back a page you should be using history.back(). Because of this change iframe's now work properly.
If you need to enable the old way to handle history you can set useBrowserHistory to false in config.xml.
8. Introduce CordovaPlugin class
CordovaPlugin will be replacing the Plugin class for extending PhoneGap functionality. It adds a new execute method public boolean execute(String action, String rawArgs, CallbackContext callbackContext) to enable developers passing large amounts of data to the native side provide their own JSON parser. It also cuts down on boiler-plate, makes multi-threading easier, and adds an application-wide thread-pool to CordovaInterface. Adds an onReset method that is called when top level navigation changes. This is where you should stop any long running processes like a file transfer that are no longer needed on the new page.
9. Various bug fixes
- Back and Menu button events now fire if the cursor is inside a text view.
- Fixed a path where the whitelist was not being checked in DroidGap.
- FileTransfer.download now supports the trustAllHosts option to allow downloading from servers with self signed certificates.
- Removed trailing space from contact.name.formatted.
- Properly set contact's IM type.
- navigator.language is now set properly when the language is switched in Android settings.