Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do mobile chrome apps run in chrome?

To put it bluntly, do Mobile Chrome Apps have anything to do with chrome at all? After all, it seems reasonable to expect that as it has Chrome in the name. This question stems from the fact that as I was porting my 'chrome based mobile app' (which does not run in the 'Browser'), I got a huge string of weird errors and for the first couple of hours I had no idea what was happening.

NOTE: This question is out of date, Mobile Chrome apps now works differently as outlined in the edit section of the main answer:

By default, Chrome Apps for Mobile leverage an embeddable Chromium WebView provided by the Crosswalk project by default, which has both advantages and some tradeoffs.

like image 869
David Mulder Avatar asked Dec 26 '22 09:12

David Mulder


1 Answers

(Note: I work on the (very small) team at Google building the open source project to bring Chrome Apps to Mobile)


First, I’ll paste the description of Chrome Apps, right from the top of the docs:

“Chrome Apps deliver an experience as capable as a native app, but as safe as a web page. Just like web apps, Chrome Apps are written in HTML5, JavaScript, and CSS. But Chrome Apps look and behave like native apps, and they have native-like capabilities that are much more powerful than those available to web apps.

Chrome Apps have access to Chrome APIs and services not available to traditional web sites. You can build powerful apps that interact with network and hardware devices, media tools, and much more.”

Next, I’ll paste the description of Chrome Apps for Mobile, right from the top of our README.md:

“You can run your Chrome Apps on Android and iOS via a toolchain based on Apache Cordova, an open source mobile development framework for building mobile apps with native capabilities using HTML, CSS and JavaScript.

Apache Cordova wraps your application's web code with a native application shell and allows you to distribute your hybrid web app via Google Play and/or the Apple App Store. To use Apache Cordova with an existing Chrome App, you use the cca (c ordova c hrome a pp) command-line tool.”


Now to answer your question: “To put it bluntly, do Mobile Chrome Apps have anything to do with chrome at all? After all, it seems reasonable to expect that as it has Chrome in the name.”

Blunt Answer:

No, they don’t run on Chrome in the same sense that they do on desktop. However, using cca they can run on Mobile in ways that are most appropriate for those platforms, and we do use the Chrome Renderer whenever/however we can.

EDIT as of July 2014: We now run apps inside the Crosswalk WebView on every version of Android (currently based on Chrome 36, but that will change with time). I described this approach at the bottom of this original answer, but some of the details about system webviews -- while still accurate -- no longer really apply to Chrome Apps for Mobile. You can read more about this on our main github page.

Sorry for the naming confusion. I do see why it is reasonable to assume what you did. The “Chrome” in “Chrome Apps for Mobile” refers specifically to the source application type, not to the target runtime type. We try to document that best we can -- Do you have a suggestion for a simple yet less confusing title?

Less-Blunt Answer:

Chrome Apps for Mobile is an open source project to build a tool to support wrapping existing Chrome Apps into Hybrid Mobile Apps, leveraging Apache Cordova.

That is, cca creates a 100% real Android/iOS app, like any other, built using the respective Mobile SDK. Additionally, for your benefit and convenience, we create an app shell that uses the system WebView component to display and run your application content. We read your application manifest, we simulate the Chrome App lifecycle, we run your background scripts, open chrome app windows, and implement many of the Chrome Apps device apis. We’ve bundled all this work up into one toolkit which we call cca. We also contribute a lot of patches to core cordova to generally make all hybrid apps on Android/iOS better.

Now, the default system WebView’s are as follows:

  • iOS: Mobile Safari WebKit based. Lots of web-platform overlap with Chrome, but not exact and diverging slowly.
  • Android 4.3 or older: Legacy Android WebView. Dated and occasionally buggy, but still fairly performant on certain tasks.
  • Android 4.4: Chrome based WebView. This initial release brought a slew of modern web apis, and enabled remote web inspector. However, it also introduced some regressions, is stuck at Chrome 30, and didn't bring all features, such as WebGL and WebRTC.
  • Android Future: Since the first launch of Chrome based WebView, it was announced that work is ongoing to make the WebView auto-update just like the Chrome Browser does.

So, on Android 4.4 we already use a real Chromium renderer to turn your Chrome App into pixels on screen. On iOS, the WebView is quite modern and performant and many apps should run fine. For Android Legacy WebView, its hit and miss. But there is hope...

Excitingly, a significant portion of our recent work on cordova-android has been on bundling a tip-of-tree chromium based “webview” alongside your app, thanks to the Intel Crosswalk project. This would mean you ship your app to the Play Store together with your very own modern build of Chromium webview. Best yet, it will work all the way back to Android 4.0. Expect announcements on how to try it yourself in the next month or so!


Finally, while there are some downsides, it's important to note the benefits of our approach:

  • By running as a real Android/iOS hybrid app, you can write your own cordova plugins to run native Android/iOS code to augment your application should you find the need to do so.
  • Your app distributes using the app store, with user reviews, auto-updates, and monetization.
  • Your app has an icon on the users' home screen, and is in the app switcher, etc.
  • Most importantly: You don't have to wait for the future! Get started today using cca, and run your Chrome Apps on iOS and Android using the webviews currently available, and soon to be improved.
like image 192
mmocny Avatar answered Feb 02 '23 12:02

mmocny