Note: This article is left here for learning purposes of plugin code. But the Flurry plugin itself is obsolete, use the newer version provided with Gideros Installation.

This is my first attempt on Gideros plugins for Android (hopefully not last). Basically its an analog of Flurry plugin for IOS using same methods as in Gideros documentation. Now you will also be able to use it on Android.

You can download plugin, example Gideros and Android project as well as JNI code here.

Folder AndroidProject contains example Android project, that uses plugin.

Folder GiderosProject contains example Gideros project, that uses plugin.

Folder StandAlonePlugin contains plugin related files, that can be copied to your exported android projects by simply copying contents of this folder to your android project.

Folder StandAloneJNI contains C++ code which was used to compile plugin.

So how to use it.

First you need to download Flurry SDK and include it in your project. To do that, right click on project and select properties, from there select "Java Build Path" and click on "Add External JARs..." and navigate to downloaded SDK jar file. 

Next you'll need to include plugin files into your exported android project. You can simply copy contents of StandAlonePlugin folder into your project folder.

Or step by step, add libflurry.so files to according directories of your exported Gideros project (libs/armeabi and libs/armeabi-v7a) and Flurry.java to "src/com/giderosmobile/android" directory.

Then you need to open main Activity inside "src/com/giderosmobile/android" folder (usually named as YourApplicationActivity, where YourApplication is the name of your application).

Add



"System.loadLibrary("flurry");"

just right after :



System.loadLibrary("gideros");
System.loadLibrary("luasocket");
System.loadLibrary("lfs");

Add Flurry class inside externalClasses like that:



static private String[] externalClasses = {
	"com.giderosmobile.android.Flurry"
};

And thats it! Now run your application and you can check for "tag:Flurry" inside you LogCat to debug your events from your application.

Example LogCat output:



D/FlurryAgent(9133): com.flurry.android.ai 56 Initializing Flurry session
D/FlurryAgent(9133): com.flurry.android.ai 56 New session
D/FlurryAgent(9133): com.flurry.android.ai 56 Event count incremented: simpleEvent
D/FlurryAgent(9133): com.flurry.android.ai 56 Logged event: simpleEvent
D/FlurryAgent(9133): com.flurry.android.ai 56 Event count incremented: EventWithParameters
D/FlurryAgent(9133): com.flurry.android.ai 56 Logged event: EventWithParameters
D/FlurryAgent(9133): com.flurry.android.ai 56 Event count incremented: TimedEvent
D/FlurryAgent(9133): com.flurry.android.ai 56 Logged event: TimedEvent
I/FlurryAgent(9133): com.flurry.android.ai 84 loading persistent data: /data/data/com.appcodingeasy.flurry/files/.flurryagent.645d1de4
D/FlurryAgent(9133): com.flurry.android.ai 56 Loading API key: **********y ID
D/FlurryAgent(9133): com.flurry.android.ai 56 Loading session reports
D/FlurryAgent(9133): com.flurry.android.ai 56 Persistent file loaded
I/FlurryAgent(9133): com.flurry.android.ai 84 Fetching IMEI: null
D/FlurryAgent(9133): com.flurry.android.ai 56 generating report
D/FlurryAgent(9133): com.flurry.android.ai 56 Sending report to: http://data.flurry.com/aap.do
D/FlurryAgent(9133): com.flurry.android.ai 56 Ended event 'TimedEvent' (19) after 1015ms
D/FlurryAgent(9133): com.flurry.android.ai 56 Report successful
D/FlurryAgent(9133): com.flurry.android.ai 56 Processing report response
D/FlurryAgent(9133): com.flurry.android.ai 56 Done sending initial agent report

Use plugin same way as described in Gideros documentation for IOS Flurry plugin.

Quick example:



--require flurry
require("flurry")

if(flurry.isAvailable()) then
	--start flurry session with your flurry ID
	flurry.startSession("your flurry ID")

	--log simple flurry event
	flurry.logEvent("simpleEvent")

	--log flurry event with parameters
	flurry.logEvent("EventWithParameters", {key="val", anotherkey="anotherval"})

	--log flurry timed event
	flurry.logEvent("TimedEvent", {key="val"}, true)
	
	Timer.delayedCall(1000, function()
		flurry.endTimedEvent("TimedEvent")
	end)
end