How to use Flury? - android

I wish to get a bit more detailed statistic about my app instead of standart google statistic. I was advised to use flury. However I dont see tutorial how to integrate it to my app or use it. Can any one explain or give a link to tutorials?

Flurry works with an ID to open a session an retrieve infos. I'm using it and it's quite simple to use.
1 - Head to flurry.com and register your app, which will generate a unique tracking code.
2 - Download and add the FlurryAgent jar to your project libraries. If you're using Eclipse, right-click your project folder, select properties, select Java Build Path, and choose Add External JARs...
3 - Add android.permission.INTERNET to your AndroidManifest.xml.
4 - Add a call to the Flurry agent from the onStart() and onStop() methods of your activities.
Note: replace the ID below with your unique tracking code.
public void onStart()
{
super.onStart();
FlurryAgent.onStartSession(this, "9GKQD4EBX123FEP6874H");
// your code
}
public void onStop()
{
super.onStop();
FlurryAgent.onEndSession(this);
// your code
}
See the answer here

1st you need to download Flurry agent.jar
and add this to your lib folder after that
do the following in following methods
private void getFlurryEvents()
{
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("Title of page", "Your page Title" );
FlurryAgent.logEvent("View Page",parameters);
}
#Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
FlurryAgent.onStartSession(this, Constants.FLURRY_API_KEY);
}
#Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
//FlurryAgent.onEndSession(this);
}
in onstart method strt the Session and in on stop stop the session and in oncreate add the method getFlurry agent
and get your API key from flurry

Related

Flurry "Event" Add

I know how to start and end Sessions in flurry
I am also able to successfully see them in my Analytics section.
What I want to implement now is events for user clicks/views.
I have a media player which plays a file. I want to see how many users have played the file till end. How add such events inside a session for a user?
Initialize a FlurryAgent after onCreate() using:
FlurryAgent.init(YourClass.this, "YOUR_API_KEY");
Start / End your sessions using: (This will come in your activity class)
#Override
protected void onStart() {
super.onStart();
FlurryAgent.onStartSession(YourClass.this, "YOUR_API_KEY");
}
#Override
protected void onStop() {
super.onStop();
FlurryAgent.onEndSession(YourClass.this);
}
Now add this line where ever you want to log the event:
FlurryAgent.logEvent("Your_event_name");
To log events with some parameters, use:
HashMap<String, String> myMap = new HashMap<String, String>();
myMap.put("key", "value");
FlurryAgent.logEvent("even_name", myMap);
Hope this will help somebody.
NOTE: If you come across the two terms FlurryAgent.logEvent and FlurryAgent.onEvent, use .logEvent
.onEvent is deprecated. Reference here

How to use Google Analytics Android SDK Custom Metrics

I try to collect a custom metric from an Android application using Google Analytics SDK v3.
The doc says to do it like this :
// May return null if EasyTracker has not yet been initialized with a
// property ID.
EasyTracker easyTracker = EasyTracker.getInstance();
// Set the custom metric to be incremented by 5 using its index.
easyTracker.set(Fields.customMetric(1), 5);
// Custom metric value sent is with this screen view.
easyTracker.send(MapBuilder
.createAppView("Home screen")
.build()
);
https://developers.google.com/analytics/devguides/collection/android/v3/customdimsmets
However set(Fields.customMetric(1), 5); is undefined because only EasyTracker.set(String,String) exists. The documentation seems not up to date with the v3 SDK.
So here is what I tried instead :
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public void onStart() {
super.onStart();
EasyTracker.getInstance(this).activityStart(this);
}
#Override
public void onStop() {
super.onStop();
EasyTracker.getInstance(this).activityStop(this);
}
public void onDetected()
{
EasyTracker easyTracker = EasyTracker.getInstance(this);
easyTracker.set(Fields.customMetric(1), "1"); //not working
easyTracker.send(MapBuilder
.createEvent("cat", "detected", "beacon", (long) 1) // also tried with createAppView
.set(Fields.customMetric(1), "1") // not working
.set("&cm1", "1") // not working
.build());
}
But none of this actually works. How can I collect custom metrics using Google Analytics Android SDK ?
Have you looked at using the method:
Tracker.setCustomMetric(int, long)
I have done something similar with a custom dimension and it worked for me (tracker.setCustomDimension(String, string)). Another gotcha that I ran into is that I had to make sure that the dimension was defined in the admin panel before GA would accept it.

+1 click is not working in Android integration with Google+

I followed this link to use the +1 button in my Android application to +1 a link or a website, but unfortunately it didn't work as expected and it didn't respond when I click on it. I tried to use the following:
mPlusOneButton.setOnPlusOneClickListener(new OnPlusOneClickListener() {
#Override
public void onPlusOneClick(Intent arg0) {
// TODO Auto-generated method stub
startActivityForResult(arg0, 0);
}
});
But also no response. As an example I tried to use the following line of code:
mPlusOneButton.initialize(plusClient, "http://www.googleplustoday.net", PLUS_ONE_REQUEST_CODE);
And there is no effect on my Google plus profile at the +1 tab.
Who can help? Thanks in advance.
Make sure to be connected to Google Plus:
mPlusOneButton.setOnPlusOneClickListener(new OnPlusOneClickListener() {
#Override
public void onPlusOneClick(Intent intent) {
if(!plusClient.isConnected()) {
plusClient.connect();
} else {
startActivityForResult(intent, 0);
}
}
}
Be sure that you initialize your mPlusOneButton prior to handling clicks such as in the onResume method. When I tested by not initializing before the click then I could get it to fail.
In the androidsdk/extras/google/google_play_services/samples/plus/src/com/google/android/gms/samples/plus/PlusOneActivity.java contains a skeleton activity for getting the PlusOne button working.
If you can post your full activity code and any applicable errors from logcat that would help further identify the issue.

Facebook Android SSO weird Error

I made a previous post and I fixed the issue in that problem but I get something weirder now. So I'm following http://developers.facebook.com/docs/mobile/Android/build/#register and everything goes fine until I actually start my app. Instead of getting an app log in page, I get this:
http://imgur.com/DHpde
I have no clue why it won't go to the app log-in page like it does for everyone else. The only thing that perhaps might be different is that I had to remove the "#Override" notations for the Facebook.authorize method call.
#Override
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
}
#Override
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
}
#Override
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
#Override
public void onCancel() {
// TODO Auto-generated method stub
See this surely you will solve your error
you need to install an extension, similar to the core Android SDK, but no, here is what you need to do:
1.) go to github.com/facebook/facebook-android-sdk
2.) download the facebook directory ONLY! The other directories are only examples.
3.) Put the files from the src (you can copy the drawables too, if you want to) in the package, you are currently working with
4.) You are good to go, you can use the facebook "SDK"
see also this example https://github.com/facebook/facebook-android-sdk/tree/master/examples/Hackbook download it , it is working example provided by facebook

Google analytics does not collect of statistics in my android app

I want to add statistic in my android application.
Read article http://code.google.com/intl/ru/apis/analytics/docs/mobile/android.html#startingTheTracker and done below
1 added library libGoogleAnalytics.jar in my application
2 added in manifest
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
3 changed source code
private GoogleAnalyticsTracker tracker;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tracker = GoogleAnalyticsTracker.getInstance();
// Start the tracker in manual dispatch mode...
tracker.startNewSession(GOOGLE_ANALYTICS, this);
tracker.trackPageView("/MainListView");
...
protected void onDestroy() {
super.onDestroy();
tracker.stopSession();
}
4 I created "fake" site for application (https://sites.google.com/site/balancetransportcardkazan/ :) )
5 registered site in https://www.google.com/analytics/,
constant GOOGLE_ANALYTICS is for this site.
statistic is empty, What I forgot to do?
You have to dispatch the changes to the server. Here is an excerpt from my wrapper class around GoogleTracker to make it easier for me.
public void trackPageView(String page) {
tracker.trackPageView( packageName + "/" + getVersionCode() + "/" + page );
tracker.dispatch();
}
public void trackEvent(String action, String label, int count) {
tracker.trackEvent( packageName, action, label, count );
tracker.dispatch();
}
public void trackEvent(String action) {
tracker.trackEvent(packageName, action, null, 0 );
tracker.dispatch();
}
As mentioned by chubbard You need to dispatch the events to get it tracked. check your logs whether requests are sent to GA server. As i have seen it usually takes around 4-5 hours for statistics to get updated. While viewing the report ensure the report date is current date. By default the report will be shown for yesterday.
I think for getting statics of your android app, you should implement google analytics code into all your classes/functions of the your app.
I think below link can help you for How to implement Google Analytics for android app -
http://www.tatvic.com/blog/android-application-tracking-through-google-analytics/

Categories

Resources