RSS Feed

Appcelerator Flurry Module for iPhone/iPad and Android

That's right!! You can now use Flurry analytics in your appcelerator apps (v1.6.2).

Android module
iPhone/iPad module

Background Info

Comprehensive website analytics are essential in today's dayan age for any company aiming to be competitive. Furthermore, Soft Gravity believes the same to be true when it comes to analytics for mobile applications. For this purpose we recently reviewed and compared a series of analytics services such as Google Analytics and Flurry Analytics. We decided to further explore Flurry, due to the fact that it was developed for mobile apps and automatically captures a lot of information about the devices.

In our environment we are using Appcelerator for mobile app development because it allows us to quickly deploy for Android and iPhone. However, at the time of writing, Appcelerator only released a small Flurry module for the iPhone (not all functions are implemented). No Android module is released. So I decided to write my own module for Android, and to expand the iPhone module to full functionality.

Download

The source code is hosted at our github. If you don't want to compile the module yourself, don't worry, the module is included in there as well!!

  • For android just look for the file dist/sg.flurry-android-1.0.zip.

  • For iPhone/iPad just look for the sg.flurry-iphone-1.0.zip in the main directory.


Design decisions

The functions are designed to mimic the Flurry SDK for the respective platforms, so that developers can refer to the Flurry SDK API to figure out how to use it. Only a few function names and parameters have been changed, which you can easily determine through the documentation. Both modules use the same id of "sg.flurry" to hopefully make it more convenient for the developer to maintain.

If you attempt to add the modules for both Android and iPhone at the same time you may run into some trouble. In order to evade any potential issues make sure your modules section in your tiapp.xml looks like this:

<modules>
       <module version="1.0" platform="iphone">sg.flurry</module>
       <module version="1.0" platform="android">sg.flurry</module>
</modules>

Important notes for Android

  • make sure to call _onEndSession_ if you want to have events sent to Flurry

  • you will most likely need to use _setContinueSessionMillis_ and set it to a high value, so that _onEndSession_ and the next _onStartSession_ will be counted as the same session

  • log messages are per-appended with "AndroidflurryModule"

  • if you are building the module yourself, please change the _build.properties_ file to set the correct directories

  • _AndroidManifest.xml_ is already configured as specified by the Flurry SDK. It is located in the file _timodule.xml_.

  • clean the android build directory before you compile


Important notes for iPhone/iPad

  • you only need to call _startSession_ once :)

  • log messages are per-appended with "SgFlurry"

  • clean the iphone build directory before you compile


Examples

Check out our github for the Flurry modules. I highly recommend it for any mobile app.

8 comments

Kevin over 1 year ago

Why do you have 2 different js apis for android and iphone? It would be nice if both the android and iphone had the same calls so I wouldn't have to wrap the calls in my own calls depending on whether it is android or iphone.

Reply    Report spam!

Tommy almost 2 years ago

@Karl-Johan Sjögren: Great job Tommy, seems to work just fine in my project. One problem however is the logEvent-method w... I have noticed that as well. I believe it is something to do with how Flurry aggregates the data. If you look at the full event logs, you will actually see the event there. That means the event actually has fired, and that's the best we can do since we just call the Flurry API. I believe it has something to do with how much data Flurry receives. Once it has more data, it becomes more accurate, although the count might still be a bit off.

Reply    Report spam!

Karl-Johan Sjögren almost 2 years ago

Great job Tommy, seems to work just fine in my project. One problem however is the logEvent-method which never seems to increase the count in my Flurry statistics. The event shows up but is always at zero. Do I need to append some parameters for it to work? / Karl

Reply    Report spam!

Tommy almost 2 years ago

@Mark: You can call onEndSession() whenever you like. Without calling this function, custom events will not be sent. The function setContinueSessionMillis() allows you to set the timeout limit between the next onStartSession() and the current onEndSession

Reply    Report spam!

Tommy almost 2 years ago

@Brice: The android wasn't too bad. You can check out the code, most of it is setting up the module.

Reply    Report spam!

Brice almost 2 years ago

You guys rock -- I've never took the time to dig in and create that missing Android plugin. How difficult was it?

Reply    Report spam!

Mark Ross almost 2 years ago

Tommy, Thank you so much for writing this. It's already helped with our iPhone app. I have a question though regarding Android. When or where would I call onEndSession()? After each logged event or using Android's 'pause' or 'destroy' events? Th

Reply    Report spam!

Nate almost 2 years ago

Yo Tommy good job. I'm going to use this on the project i'm launching soon!

Reply    Report spam!





Please fill the fields marked with *

Calendar

Su Mo Tu We Th Fr Sa
28 29 30 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Recent Posts

Building a Rails 3 almost 2 years ago
Automated Testing... almost 2 years ago
Introduction to CSS3:... almost 2 years ago
Appcelerator Flurry... almost 2 years ago
Facilitating 2 years ago

Archive