Running AIM in an emulator - adapt-it/adapt-it-mobile GitHub Wiki

This topic contains some of the ways that you can test out adapt-it-mobile.

Running in a web browser

To test out adapt-it-mobile in a browser, double-click on the file index.html, located in the folder adapt-it-mobile/www.

Note: If the file opens up the Chrome browser and you see a blank grey screen, you'll need to open the file up in another browser. Safari or FireFox will work fine.

Live Preview in Brackets

Brackets has a "Live Preview" feature that will let you work in html / js / css files and see the results in a browser window that's synched with the code. To view the code in live preview mode:

  1. Open the file index.html under adapt-it-mobile/www in the Brackets editor (i.e., select it in the left hand column so that it shows up as the active file being edited).

  2. Click on the "lightning bolt" icon in the right hand column of the editor. You should see the web browser launch with the index.html page open. You can open up the www/res/css/styles.css file and the web browser will highlight the element you select in the Brackets editor.

Notes

  • Live Preview did not work for me out of the box on a Linux port. I needed to install Chromium, and then Live Preview worked for me.
  • If you see a blank grey screen... yes, you guessed it, Brackets uses Chrome / Chromium for live preview. You can try the flag listed in the troubleshooting topic; if that doesn't work, Live Preview might not be an option.
  • (whm added14Nov2015) A work-around for a blank grey screen in Chrome / Chromium is to open a terminal and type: 'killall chrome' and then try the Live Preview option from within Brackets. This worked for me on Linux.

Running in an Emulator

Once you have compiled adapt-it-mobile locally (or have downloaded the app from the PhoneGap Build service), you can run the code in an emulator.

Android

  1. Make sure you have created at least one Android Virtual Device. This can be done in two ways:
  1. From the command line, CD into the adapt-it-mobile directory.
  2. Enter in the following command: cordova emulate android.

Notes

  • If you have several AVDs set up and you want to run in a particular one, first launch the AVD you want in the AVD Manager (select the AVD, then click the Start... button). Then open a new terminal window and do steps 2 and 3 above.
  • To copy test files to / from the emulator device, use the Android Device Monitor. From the command line, type: monitor. Once the monitor launches, click on the File Explorer tab on the right pane and navigate to the path data/data/org.adaptit.adaptitmobile/files/Documents directory. Click on the right arrow icon to push a file to the device, or the left arrow icon to pull a file off the device.

iOS (command line)

  1. From the command line, CD into the adapt-it-mobile directory.
  2. If you haven't already done so, install the ios-sim module. Type the following command and press enter: sudo npm install -g ios-sim. (Also enter your password when prompted.)
  3. Enter in the following command: cordova prepare ios.
  4. Enter in the following command: cordova emulate ios.

iOS (XCode)

  1. In the Finder, navigate to the platforms/ios directory and open up the file 
“adapt-it-mobile.xcodeproj”.
  2. In the Xcode toolbar, note the scheme “Adapt It” is selected, and there are several simulator options:
  • iPhone Retina (3.5 inch)
  • iPhone Retina (4 inch)
  • iPhone Retina (4 inch / 64 bit)
  • iPad
  • iPad Retina
  • iPad Retina (64-bit)
    Select one of these simulators from the list.
  1. Click the Play button in the toolbar (the right-pointing triangle) to compile and run the Adapt It Mobile application in the simulator.

iOS Note To copy files to the device, do the following:

  1. Note the directory in the output console (xCode) when AIM is launching. This is listed in a debug output message from the SQLite plugin similar to this: open full db path: /Users/erik/Library/Developer/CoreSimulator/Devices/726A181A-D7D3-46E9-9259-D0804FE2159E/data/Containers/Data/Application/2D821625-2AEE-4B86-9BF3-D9AF4253D21E/ (the GUIDs and user name will be different). Copy JUST the path string up to the /Application/[guid value] part.
  2. In the OSX Finder, select the Go/Go to Folder... menu item. Paste in the path string from step 1 to open up the emulator directory.
  3. In that Finder window, open up the Documents subdirectory. This is where you'll be copying the documents and project files to.