Android google analytics integration error

后端 未结 2 1784
旧时难觅i
旧时难觅i 2021-01-11 23:37

When i am trying to get tracker in my activity it show error that -this method is undefine \"getactivity()\" in google analytic v4

// Get tracker.
    T         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-12 00:22

    I too faced this issue a little while back. To solve it I, as mentioned above, removed getActivity() as well as adding .MyApplication to android:name in the manifest. However I needed to add MyApplication before TrackerName as shown below.

    Tracker t = ((MyApplication) getApplication()).getTracker(MyApplication.TrackerName.APP_TRACKER);
    

    Hope this helps

提交回复
热议问题