title: Google Analytics demographics For Android App
body: <p>I used Google Analytics Demographics on android app using Google play service library.
  i have updated my android code using enableAdvertisingIdCollection().
  its working fine with screens and data. But its demographics info isn't working?
  Please suggest how do i handle demographics.</p>
  
  <p>thanking you.</p>
  
  <p>Code : 
  Application code : </p>
  
  <p>...</p>
  
  <pre><code> synchronized Tracker getTracker( TrackerName trackerId, String appKey)
   {
  
      Log.d("Application", "In Application class getTracker PID" + appKey);
      if (!mTrackers.containsKey(trackerId))
      {
  
          GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
  
          analytics.setDryRun(false);
  
          analytics.getLogger().setLogLevel(Logger.LogLevel.INFO);
  
          Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(appKey) : analytics
                  .newTracker(R.xml.app_tracker);
  
          if (t != null)
          {
              t.enableAdvertisingIdCollection(true);
          }
  
          mTrackers.put(trackerId, t);
  
      }
      return mTrackers.get(trackerId);
  }
  </code></pre>
  
  <p>...</p>
  
  <p>code on oncreate()</p>
  
  <p>...</p>
  
  <pre><code> try
   {
  
      GoogleAnalytics.getInstance(getActivity()).reportActivityStart(getActivity());
  
          Tracker t = ((AppApplication) getActivity().getApplication()).getTracker(TrackerName.APP_TRACKER, Appkey);
          t.setScreenName("Home Screen");
          // t.setSampleRate(sampleRate);
          t.enableAdvertisingIdCollection(true);
          t.send(new HitBuilders.AppViewBuilder().build());
  
  
      }
      catch (Exception ex)
      {
          CustomLogger.showLog("GAcode", ex.getMessage());
      }
  </code></pre>