English subtitles

← Start Tracking

Get Embed Code
4 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. So now, you've defined the code in your
    application class to start tracking.
  2. But so far, there's nothing that
    triggers the startTracking method.
  3. But, all you need to do to activate
    tracking is to call the start tracking
  4. method that you just wrote.
  5. You can call it in
    onCreate in MainActivity.
  6. And, Activity can call getApplication
    to get the application singleton for
  7. the running app.
  8. However, since you're using your
    own subclass of application,
  9. you need to cast the result
    to your subclass.
  10. Once you've got
    the application instance,
  11. it's a simple matter of calling
    startTracking to kick off tracking.
  12. And, you have to get your parens right.
  13. So, go ahead and
  14. add the code to onCreate in MainActivity
    to start analytics tracking.
  15. And, make sure your project compiles.