I have an Android keyboard app that I am developing, and it displays simple characters, not a language, so I would like to be able to track user activity, as there is no important information or words there.
The problem is that the Android InputMethodService does not extend the Application , which allows you to access the Google Analytics Android SDK (possible wording in the wording here, do not hesitate to correct me).
I began to be guided here , and this is the code I referenced to get the Tracker object:
package com.google.samples.quickstart.analytics; import android.app.Application; import com.google.android.gms.analytics.GoogleAnalytics; import com.google.android.gms.analytics.Tracker; public class AnalyticsApplication extends Application { private Tracker mTracker; synchronized public Tracker getDefaultTracker() { if (mTracker == null) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
This is great for tracking the main activity of my application, which is basically a view containing a short set of instructions with several ads and a settings shortcut.
As I said, I would like to track the keyboard, and how to do this is not entirely obvious, since InputMethodService does not disclose Google Analytics.
How to use the Google Analytics SDK for Android in a class that extends InputMethodService but not Application ?
Please tell me, if I have not made my problem clear, I will update the message in any way possible.
source share