Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Meteor be used with PhoneGap?

Tags:

meteor

cordova

Can a Meteor template be packaged up and deployed as a PhoneGap application?

like image 974
Marcus Estes Avatar asked Apr 25 '12 19:04

Marcus Estes


People also ask

Is PhoneGap still relevant?

And referring to marketing signals, it should be mentioned that PhoneGap Build was discontinued in October 2020.

Is PhoneGap and Cordova same?

Both PhoneGap and Cordova are open-source cross platform frameworks but with different names. Cordova, at this point, is the open source platform that was formerly called PhoneGap. Both the terms can be used interchangeably because they both can help build mobile applications using HTML, CSS, and JavaScript.

What is app made from JavaScript and PhoneGap called?

Hybrid apps are developed using web technologies: HTML5, CSS and JavaScript, then put inside a native container such Adobe PhoneGap. These native containers run the web application code and package it into an app.

What are the tools required to develop the PhoneGap application for Android?

Eclipse ADT Plugin ADT (Android Development tools) is a plugin of eclipse which provide a complete IDE for developing Android application. ADT lets you create new Android projects, and it lets you create Android projects from existing source (this is the way we will open our PhoneGap app for android on eclipse).


2 Answers

Yes, this is possible, but not by packaging the meteor app on the phone. You have to point phonegap to your meteor server instead (you will still be able to use the API for accessing functionality on the device). Here are the instructions:

  • Grab the latest copy of phonegap 2.2.* from https://github.com/phonegap/phonegap (2.1 has a bug that prevents this technique from working)
  • Create your phonegap project and whitelist your meteor server domain name using the instructions here: http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html
  • For iOS, find and open CordovaLib/Classes/CDVViewController.m and around line 175, overwrite appURL with appURL = [NSURL URLWithString:@"http://your-server.com"];

That's it. Compile and run the app.

A couple of time savers:

  • You can start setting up your meteor directory by copying the www/ directory contents into your meteor server root directory. Make sure to copy the javascript files under the client/ directory so that they get loaded before the main meteor js file.
  • Run app.initialize(window) from your main meteor js file, if the window parameter is not passed, the app will crash.
  • Don't try to set up the meteor server under the www/ directory in Xcode. You won't be able to deploy to a device because the .meteor subdirectory contains symbolic links to your node modules.
like image 59
snez Avatar answered Sep 20 '22 10:09

snez


As of 0.9.2 version of meteor it is easy to use Phonegap: https://www.meteor.com/blog/2014/09/15/meteor-092-iOS-Android-mobile-apps-phonegap-cordova

like image 31
Mitja Bezenšek Avatar answered Sep 23 '22 10:09

Mitja Bezenšek