首页 > 代码库 > PhoneGap集成
PhoneGap集成
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
$ cordova platform add iOS
$ cordova build
This generates platform-specific code within the project‘s platforms
subdirectory. You can optionally limit the scope of each build to specific platforms:
$ cordova build ios
The cordova build
command is a shorthand for the following, which in this example is also targeted to a single platform:
$ cordova prepare ios
$ cordova compile ios
In this case, once you run prepare
, you can use Apple‘s Xcode SDK as an alternative to modify and compile the platform-specific code that Cordova generates within platforms/ios
. You can use the same approach with other platforms‘ SDKs.
Test the App on an Emulator or Device
SDKs for mobile platforms often come bundled with emulators that execute a device image, so that you can launch the app from the home screen and see how it interacts with many platform features. Run a command such as the following to rebuild the app and view it within a specific platform‘s emulator:
$ cordova emulate android
Some mobile platforms emulate a particular device by default, such as the iPhone for iOS projects. For other platforms, you may need to first associate a device with an emulator.
PhoneGap集成