神刀安全网

Mobile improvements in Meteor 1.3

Meteor has enabled you to build mobile apps from the same codebase you use to create regular web apps for quite some time. With a few simple commands, you can take an existing app and run it on a mobile device. By using a set of standard APIs, you can take advantage of native device features not usually available to web apps. This is made possible by integrating with Cordova , a well-known Apache open source project that bundles your web app into a native app.

With the release of Meteor 1.3, we’ve improved on the mobile support relied on by many existing Meteor apps to deliver a more robust user experience and to take advantage of platform enhancements. We’ve also expanded and consolidated documentation.

Mobile article published as part of the Meteor Guide

The Meteor Guide, published for the first time with Meteor 1.3, includes an extensive mobile article that replaces previous documentation and also covers new topics, ranging from how to use logging and remote debugging tools to accessing local files and remote resources. We think the guide will be a great resource for beginning and more advanced mobile developers alike, and we encourage you to contribute your experiences so we can make it even better.

Rewritten hot code push support

One of the major features of the Cordova integration in Meteor has always been hot code push. This allows you to push new versions of your app to users’ devices without going through a p otentially lengthy review process to update your app on the App Store or Play Store.

In Meteor 1.3, we’ve completely rewritten hot code push support, resulting in much more performant and reliable updating. We’ve moved file transfer functionality to native code on both iOS and Android. This allows us to use modern downloading mechanisms that don’t slow your app down while an update is in progress.

In addition, a hot code push will now only download modified files, which should make updating faster and use less data, which is especially important over mobile connections. We also verify the files we download to make sure we end up with the exact version we expect, even if the app on the server changes during downloading of an update.

To avoid faulty JavaScript code from breaking your app, we’ve added a safety mechanism that reverts your app to the last known good version in case startup doesn’t complete in time (with a configurable timeout). This means users will be able to keep using your app even when you push a broken update by mistake.

iOS apps use WKWebView by default, on both iOS 8 and 9

Over the years, JavaScript performance has improved immensely, mainly as a result of ever new generations of Just-In-Time compilers. Unfortunately, UIWebView, the web view available on iOS, has not been able to profit from these innovations, because the iOS security model does not allow app processes to use the executable memory a JIT needs.

When Apple introduced the modern WebKit API in iOS 8, they added WKWebView as a replacement to overcome these limitations. Because WKWebView runs in a process separate from your app, it is allowed to use the JIT, resulting in a 3–4x JavaScript performance increase over UIWebView.

Meteor now uses WKWebView by default, which results in much better responsiv eness and improved frame rate for your app.

  • You may have encountered reports of limitations of WKWebView under iOS 8, which is one of the reasons many Cordova apps still use UIWebView. These limitations mainly refer to the inability to load apps from a file:// URL, which is not an issue for Meteor because we serve your app from localhost instead.

Android apps can opt-in to use Crosswalk

Introduced in Meteor 1.2, Android apps can opt-in to use Crosswalk by installing the crosswalk package. This replaces the built-in Android web view with a more recent version based on Chromium, the open source project behind the Chrome browser. In order to do so, Chromium needs to be embedded within your app, meaning the size of your app will grow by about 20MB. But the benefits are likely to be worth it, because you can now rely on a consistent web view with considerably better performance and enhanced standards support.

What will the future of mobile development in Meteor bring?

We believe Meteor 1.3 is a great platform for mobile development using web technologies, and we can’t wait to see what people build with it.

A question we get asked a lot is whether we are also working on an integration with React Native. While we think React Native is amazing technology, we believe a tight integration is not the way to go, and we think it makes more sense to open up Meteor to the wider JavaScript ecosystem instead. Meteor’s move to npm for example, may make it easier to use DDP and minimongo from a React Native app. In the meantime, there are several community packages available, and those of you willing to experiment with these may want to follow Spenser Carli’s excellent posts on Medium .

Another technology of interest to mobile developers is GraphQL, which we are building on with our Apollo data stack . We think Apollo will be a great fit for mobile apps, and we hope to have more to announce on that front soon.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Mobile improvements in Meteor 1.3

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址