Install & Getting started
January 2015 - Tony Pigram
"I want to get up & running in 5 minutes, show me how..."
All content in these presentations is for example learning exercises, it has no official support from IBM and if you wish to use this material, you must make sure it is fit for your purpose. No warranty is implied or given.
Visit the official website and select 'Get the Developer Edition'
*Note the text about 'Worklight' being re-branded as 'IBM MobileFirst Platform Foundation'
To use MFP, you need a copy of Eclipse. Juno,Kepler&Luna are supported. I chose to download Kepler at the start rather than in a couple of steps further on, the choice is yours.
Select the 'Get the Developer Edition' button
Let IBM know who you are and press the 'Submit' button to proceed
The 'Overview' tab has links to the other tabs, which we shall walk through one by one
Take note of Point 2 - I had an earlier version installed and an attempt to upgrade did not work, so heed the advice, uninstall/remove the previous eclipse and install a fresh environment
If you're more of a hardcore command-line guru and don't want the hassle of a GUI IDE, then MFP offers you the ability to do everything via the command-line and you can use SubLimeText2 or notepad++ to write all your code with, it's totally up to you.
*I'm going to skip installing the Test Workbench for now, but will return to this as a full demo of how to use it later on
After the MFP Studio plug-in has been installed, you need to restart eclipse.
When you do this is the first screen presented to you, it provides links to the original website, the getting started pages we should still have open and a link to Stackoverflow.com - which is the new place to post support related questions or to search to see if your issue has already been queried and answered.
Even though I'm using a Mac and have an iPad, I'm still more of an Android kind-of-guy, so it could be force of habit for the past 5 years, but after installing eclipse I feel compelled to install ADT. Let's stick with the tried & tested approach of installing via the plug-in method.
Select the top-level checkbox to install all of the 'Developer Tools'.
(I'm also assuming that you've got a JDK installed already? You do, don't you? You wouldn't be reading this if you haven't already got that setup, right?)
To double-check all went well, in eclipse take a look at 'Window' and if you see the SDK Manager, all is good.
Rather than re-inventing the wheel, we just want to prove that everything is setup and working okay in our environment, before we make that killer app.
We can add our own libraries later if we need to. We probably will as you may have noticed I prefer to use AngularJS nowadays instead of JQuery or Dojo.
After selecting 'MobileFirst Project' from the Toolbar
Select 'Hybrid Application'
The project is now made for us.
It contains the basic structure required for the simplest MobileFirst application
Let's add an ENVIRONMENT to deploy our HelloWorld app to. I'll choose Android (as we installed & set it up earlier).
As you can see the Android app build finished okay.
To Run the app on the MobileFirst Development Server we right-click the folder underneath 'apps', select 'Run As' and select 'Run on MobileFirst Development Server'
When attempting to launch the Server, it failed with the messages as shown here.
Checking the Server settings all appears to be setup okay.
The hostname and port numbers are not in conflict with anything else running on the machine.
Due to previously running an external WLP server on the same machine, it was still running in the background and therefore had locked the ports for this host.
Now you know, if you see that error message again, this is the likely cause. A reboot later and we can manually 'Start' the server and see the output is successful.
To Deploy the MobileFirst app to all environments and then be able to Preview them, right-click the main project name and select 'Open MobileFirst Console'
(*Do not confuse the word Console here for a console window, it is the same Web based Operations Console that existed in Worklight)
If you click on the 'Android' link then the Mobile Browser Simulator web page will open up and show you the HelloWorld app executing in a simulated Android environment.
If you click on the 'Preview as Common Resources' link then a web page will open up showing you the Hybrid app executing as it would in a web browser.
You can use the Google AVD (Android Virtual Device) that simulates a proper Android device or you can use alternatives, depending on who you are and what you are using them for.
One such option (for Personal use) is GenyMotion.
In the Studio, right-click the generated Android application and select 'Run As', 'Android Application'. Select the already running Android device. This will download the actual .apk file to the device and execute it. All going well, you should see the screen on the right.
Remember that CLI Package we downloaded and installed earlier?
From a Terminal Console window, you can now perform all the commands that the IDE performs from the command line.
Just remember that the command line is invoked with mfp now and not wl