- Install android SDK, you can find it at this link: http://developer.android.com/sdk/index.html
- Make sure you have Eclipse 3.6 or newer
- Next we need to set up the ADT plugin in eclipse, so open eclipse select “Help” and click “install new software…”, click Add, in the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/ then click OK, and install the add-ons that come with it, when installation is complete restart eclipse.
- Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).
- Select Android from the left panel. You may see a dialog asking whether you want to send usage statistics to Google. If so, make your choice and click Proceed. You cannot continue with this procedure until you click Proceed.
- For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
- Click Apply, then OK.
- Go to Windows, click on Andriod SDK manager, can either select all and install them or just the version we need for our app witch is the 2.3.3 (API 10)
- There is a great perspective called DDMS for debugging with both the emulator and device. This comes with the ADT. From Eclipse: Click Window > Open Perspective > Other... > DDMS Setting up the code and projects There are three projects:
- snotg_web_gae - This is the Google App Engine project containing the back-end services
- snotg_android - This is the Android device project
- snotg_android_test - This is the Android JUnit test project. JUnit tests will not run in an Android project and requires a separate test project. Android unit testing is still very “green”. We did very little automated unit testing. This project is not required to run the app.
The source code is currently in DePaul’s SVN repository svn://apollo.cti.depaul.edu/SNotG.
A zip of these projects is also made publicly available on GITHub: https://github.com/rayelward/snotg_package . Download the projects and unzip them. Then import them into Eclipse as projects.
See screenshots at:
https://docs.google.com/document/d/1E1F2A2AVYp7ES3nzAs4P19c8LL8Fx8UYQnpQELkC_-8/edit
- To run the GAE project, right-click Run As > Web Application (NOTE: the option with the Google ‘G’ icon/glyph). Note it will run on port 8888 locally and 80 in the cloud. If you don’t see this option, it means you don’t have the Google App Engine plugin for eclipse installed. It can be found at: http://code.google.com/appengine/docs/java/tools/eclipse.html#Installing_the_Google_Plugin_for_Eclipse
-
Locally, start the GAE project. Go to url: http://localhost:8888/_ah/admin/
-
In the cloud, https://appengine.google.com/start
a. The snotg_web_gae project represents the service running on the Google App Engine, In order to deploy it to GAE you will need to right click on the project and go to google and click deploy to app engine (You will need to provide a gmail login)
b. IMPORTANT: LOOK for the Google icon in the lower-left of the Eclipse ide. It will either say, ‘Not Connected’ or name the account you are currently logged-in as. You must be logged-in as ‘se491snotg’ in order to deploy the app in the cloud. Right-click to change login.
c. There are two instances of the clould GAE under the se491snotg Google account: se491snot.appstore.com, se491snotg-2.appstore.com. This is important to configure the one you want to run against in the Android strings.xml for the android app. Running Locally - one time setup Create a map key: Look this up on the web. You have to create a development map key for your machine in order to use mapping on the emulator. This is simple and well-documented on the web. Look this up how to do it. Creating a Google Account for the emulator: You will need to create a Google account or accounts on the emulator to test with. This is done the exact same way as with a real android device. Look this up on the web if unsure.
NEXT, it is important to save this emulator profile so it is not lost every time the emulator is restarted.
In a nutshell: -
Start the emulator. BUT, in start dialog uncheck the 'Save to snapshot..." checkbox. Make sure "Launch from snapshot" is checked.
-
Add account as you would expect to emulator
-
Save the emulator profile. To do this, telnet to the emulator and run adv tool (e.g. with putty) $ telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
Android Console: type 'help' for a list of commands
OK avd snapshot save foo
- That's it. Next time when starting the emulator, make sure the 'Launch from snapshot' is checked and your account will still be setup. If this is not done, you will lose the account setup every time the emulator is restarted.
Here is a good link describing more detail: http://stackoverflow.com/questions/4842612/how-do-you-save-android-emulator-snapshot
You can run the app locally either on the emulator or a tethered device. You can point these to either the local GAE running or the cloud. Which GAE back-end service to use must be defined in the android strings.xml. This tells android where to connect. To run in the cloud: se491snotg.appspot.com 80 To run using the local GAE: 10.0.0.2 8888 ***NOTE: 10.0.0.2 is the machine localhost from INSIDE the emulator
The GAE needs test data in order to run. Servlets exist to do this. Run the admin jsp below. There is a link to populate data for the user and user_profile tables. There is a separate link for the user_location table. The default page (index.html) for the GAE is a useful page that has links to services to populate dummy data and other relevant admin functionalities.
a. These are: localhost:8888
b. http://se491snotg-1.appspot.com/ and http://se491snotg.appspot.com/
- Need to set up the emulator first, so open eclipse and go to window and click AVD manager, then click new and add a new android device making sure the platform is 2.3.3 (API 10).
- Then right click on SNOTG_android project and click run as android application, you should see the emulator opening and start loading up with the app.
- When the app opens you’ll see a login screen. Choose the account to authenticate with.
- After you login you will have 4 tabs that you can use, The screen should open up to the second tab called “Maps” where you can begin to use all the functionality within the app. a. Set the emulator location from the eclipse DDMS or command line. If this is not done, the emulator location is (0,0) out in the Atlantic ocean and will never have Nearby Users
SNotG is only in its first release and there are still some config dependencies that if not in place can cause confusing errors. These come from the manually seeding the data. Often if this gets in a bad state, can cause problems. Here are some miscellaneous errors that can arise and how to resolve them.
-
When on the map and double-clicking a user pushpin to see their shout and a Json parsing error results, one should verify:
a. user and user_profile table entry exists for the user. If these are missing, it will cause an error.
-
If running the emulator and wanting to test the map functionality:
a. Set the emulator location from the eclipse DDMS or command line. If this is not done, the emulator location is (0,0) out in the Atlantic ocean and will never have Nearby Users
b. Make sure dummy location data is seeded and exists. Remember there is a 5 minute expiration for user locations. So, after seeding, in 5 minutes they will get removed by the GAE clean-up job and you won’t have near by users
-
IF no map shows up in the emulator (you only see a grid with grey background), make sure a proper dev map key exists for your machine and this key is set in the strings.xml file of the android project.
-
Any exceptions on android when selecting users on the map or clicking the balloon to chat, VERIFY that the user exists in the User and User Profile tables. This is a common error when changing dummy data.
-
Development can be done without an internet connection by running the local GAE instance and using the emulator or tethering a device.