ah of course you need to make getTracker().. Ended up doing it like this, 
got a compile will know later if it works:

// The following line should be changed to include the correct property id.
  private static final String PROPERTY_ID = 
Prefs.GOOGLE_ANALYTICS_AGENT_ANDROID;// "UA-XXXXX-Y";

  /**
   * Enum used to identify the tracker that needs to be used for tracking.
   *
   * A single tracker is usually enough for most purposes. In case you do 
need multiple trackers,
   * storing them all in Application object helps ensure that they are 
created only once per
   * application instance.
   */
  public enum TrackerName {
    APP_TRACKER, // Tracker used only in this app.
    GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: 
roll-up tracking.
    ECOMMERCE_TRACKER, // Tracker used by all ecommerce transactions from a 
company.
  }

  HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, 
Tracker>();
    
    synchronized Tracker getTracker(TrackerName trackerId) {
    if (!mTrackers.containsKey(trackerId)) {

      GoogleAnalytics analytics = 
GoogleAnalytics.getInstance(AndroidNativeUtil.getActivity());

       Tracker t = analytics.newTracker(PROPERTY_ID);
      
      mTrackers.put(trackerId, t);

    }
    return mTrackers.get(trackerId);
  }
    
    public void doTracking() {
        
        // Get tracker.
        //getTracker() does not exist!!!
        Tracker t = getTracker(TrackerName.APP_TRACKER);
        
        // Set screen name.
        t.setScreenName("Splash");//i didnt know what to put in here so i 
put splash for now since it should launch the app thorugh that each time 
anyway

           t.send(new 
HitBuilders.ScreenViewBuilder()/*.setCampaignParamsFromUrl(campaignData)*/.build());
        
    }





On Monday, August 22, 2016 at 7:46:31 AM UTC+8, Gareth Murfin wrote:
>
> I am trying to implement this: 
> https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-campaigns
>
> but getTracker() does not exist when I do this, 
>
> Tracker t = 
> AndroidNativeUtil.getActivity().getApplication().getTracker(TrackerName.APP_TRACKER);
>
> How do I get around that ? Im thinking maybe all the google tracking stuff 
> has updated on their end, but maybe not yours? 
>
> It looks like some time ago I managed to get a tracker using this: 
>
> GoogleAnalytics analytics = 
> GoogleAnalytics.getInstance(AndroidNativeUtil.getActivity());
>         analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
>         analytics.setLocalDispatchPeriod(1800);
>
>         _("//// Start analytics for 
> "+Prefs.GOOGLE_ANALYTICS_AGENT_ANDROID);
>         Tracker t  = 
> analytics.newTracker(Prefs.GOOGLE_ANALYTICS_AGENT_ANDROID);
>
> I wonder if this is still safe to use?
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/8bf5a048-f21f-47c6-8daa-2d22fcaff92c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to