At first, this project was very daunting. We needed to develop an entire app from scratch. I didn't have much Android Experience (other than Prog1) so I knew there would be a steep learning curve, especially for connecting the phone to the wear and passing data and messages back and forth. The app would retrieve information about recent earthquakes. When a new earthquake occurs, the user would be alerted through the SmartWatch and the SmartPhone. Otherwise, whenever a user opens the app, it would provide he or she with a list of recent earthquakes. By clicking on one of these events, the user can have an interactive experience, seeing the location of the earthquake on a map, as well as having the option to view pictures near the earthquake location.
I will provide a summary of my implementation. I have a EarthquakeService that is constantly retrieving information about any recent earthquakes. My MainActivity provides the UI for the list of earthquakes. When a user clicks on any of the earthquakes, the app jumps to the MapActivity, where the location of the earthquake is pinned. Furthermore, once the user shakes his or her SmartWatch, the SmartWatch sends a message to the SmartPhone, alerting that the SmartWatch has been shaken. Consequently, the mobile app then starts the ImageActivity which provides images taken by people near the earthquake location. I utilized the Instagram API to retrieve these images. Once the user taps on the watch screen, I send a different type of message to my SmartWatch. When the SmartWatch receives the "tap" message, it brings the MainActivity back to the top of the stack, providing the user with the list of earthquakes interface once again. From here on, the user is able to choose any of the other earthquakes and go through this interaction again. On the SmartWatch side, a MainActivity handles all aspects of the Wear app. It receives data from the SmartPhone through the Wear Data Layer and creates a corresponding notification with the information given. It also senses shakes and screen taps and sends a appropriate message to the SmartWatch. I utilized new threads to perform a lot of the HTTP requests because the Main UI thread is prohibited from performing network operations.
Seeing the end result was very rewarding because of the level of communication that was needed between the phone and the watch. In the beginning, I could see no end. But I was glad to see it all come together.
Comments