Due: Wednesday March 13
Submission link: http://crowdlab.soe.ucsc.edu/crowdrank4/submission/submit/7
In this homework, you need to add two activities to the application you developed for hw4:
- Map Activity (OPTIONAL)
- Direction Finder Activity
Note: If your homework 4 failed to work, you can now rate other student's homework 4 submissions, and thereby, looking at working solutions, be able to get your implementation to work, hopefully.
This is optional, as Google has just stopped giving out the API keys that made this work in the emulator. This means, you do not need to do this for the homework. Do it ONLY if you want to learn how to use maps, and have an android device.
From the main activity, where the list of nearby taggings and the buttons to add a tagging are, you should be able to go to a Map Activity. It is up to you how to do this: you can use tabs, or you can also simply add a button to the main activity that says something like "view map".
Once you are in the Map Activity, you should display a map with markers that indicate the position of the taggings you have in the list. You can put the tag name as the title of that. You don't need to display the bearing. You should try to cause the map to display the current location of the user.
Direction Finder Activity
If you touch the entry for a tag in the list in the Main Activity, you should go to a Direction Finder Activity for that tag.
Note: It would be great if you could also put a "View Directions" message in the body of the information bubble associated with the tag in the Map Activity, but this is optional.
Once in the Direction Finder Activity, you should draw a compass.
- The compass should have one additional arrow that indicates the bearing to the tag.
- The compass should be oriented so that it points to North on the phone: use the magnetometer sensor to orient the compass.
Moreover:
- At the top of the view displaying the compass, you should display the tag name (so that people know what they are navigating towards).
- At the bottom, you should have a text edit field labeled "North Bearing", and a button next to it that says "Set". People can manually enter a bearing there (in degrees from North, both positive or negative degrees should be accepted), and the compass then jumps as if the magnetometer read that bearing. The idea is that people running the app in the emulator, and people whose phones do not have a magnetometer, can develop and test the apps by entering magnetometer readings manually.
- The Maps API was presented in Lecture 13.
- You can find a sample implementation of the compass in the resources for Lecture 16. This compass already turns to a defined heading when you press the button. All you need to do is:
- Add an arrow that points to the bearing of the location.
- Instead of a button that rotates the compass to a fixed orientation, use the magnetometer, or use a textedit + button to define the heading.
- In this app, you need to share the list of taggings across three activities: the main activity, the Maps Activity, and the Direction Finder Activity. The best is to keep the ArrayList of tags in a singleton object that is shared with all activities. Sharing via singleton objects was discussed in Lecture 3.
- For referencing the map activity, note the following posts: