Flurry for Android
Monkey Targets Forums/Android/Flurry for Android
| ||
I've found a wrapper for IOS Flurry and wrapped it also for Android: Here are the source files: https://github.com/JochenHeizmann/Horizon-for-Monkey/blob/master/flurry.monkey https://github.com/JochenHeizmann/Horizon-for-Monkey/blob/master/native/flurry.android.java |
| ||
Thanks! I didn't knew about flurry analytics. www.flurry.com btw, is it that important to use this kind of services? I mean, is it really useful for indie developpers? |
| ||
I mean versus google ad service |
| ||
but flurry analytics is something different than ad service... and as every tool, it's useful if you use it. |
| ||
Hi guys! @maverick69: Thanks for the very useful flurry code! I've managed to incorporate it into my monkey application for android. After about six hours some analytics started showing up on Flurry! I set it up to log a non timed event for every touch as well. Unfortunately, it's been 2 days and no event data has showed up on flurry. Any idea what might be wrong? I've included the code for my simple test. Replace <My Unique Application Key> with your own. [monkeycode] Strict Import mojo Import flurry Global Event:Int = 0 Class Game Extends App Method OnCreate:Int() SetUpdateRate( 60 ) Return 0 End Method OnUpdate:Int() If TouchHit(0) Event = 1 Flurry.LogEvent( "Touch" ) EndIf Return 0 End Method OnRender:Int() Cls DrawText("Test!", 0, 0) If Event = 1 DrawText("Touch Hit!", 0, 15) Event = 0 EndIf Return 0 End End Function Main:Int() Flurry.Init( "<My Unique Application Key>" ) New Game() Return 1 End [/monkeycode] |
| ||
I've done some research and testing and with some modifications to maverick69's code I've managed to get events to log successfully on Flurry. Hope anyone tracking analytics finds this useful! The main change was adding the Stop function to flurry.monkey. I believe this helps to mark a session as closed . Since flurry submits logged data on the next execution of a session, if a session is not closed explicitly it treats the session as still closed. I think this is the reason that no events were sent. Here are my files: main.monkey [monkeycode] Strict Import mojo Import flurry Global Event:Int = 0 Class Game Extends App Method OnCreate:Int() Flurry.Init( "<My Unique Application Key>" ) SetUpdateRate( 60 ) Return 0 End Method OnUpdate:Int() If TouchHit(0) Event = 1 Flurry.LogEvent( "Touch" ) EndIf Return 0 End Method OnRender:Int() Cls DrawText("Test!", 0, 0) If Event = 1 DrawText("Touch Hit!", 0, 15) Event = 0 EndIf Return 0 End Method OnSuspend:Int() Flurry.Stop() Return 0 End End Function Main:Int() New Game() Return 1 End [/monkeycode] flurry.monkey [monkeycode] Private #if TARGET="ios" Or TARGET="android" Import "native/flurry.${TARGET}.${LANG}" Extern #if TARGET="ios" Class Flurry Function Init:Void(apiKey$)="Flurry::Init" Function Stop:Void()="Flurry::Stop" Function LogEvent:Void(eventName$)="Flurry::LogEvent" Function LogEventTimed:Void(eventName$)="Flurry::LogEventTimed" Function EndTimedEvent:Void(eventName$)="Flurry::EndTimedEvent" End #elseif TARGET="android" Class Flurry Function Init:Void(apiKey$)="Flurry.Init" Function Stop:Void()="Flurry.Stop" Function LogEvent:Void(eventName$)="Flurry.LogEvent" Function LogEventTimed:Void(eventName$)="Flurry.LogEventTimed" Function EndTimedEvent:Void(eventName$)="Flurry.EndTimedEvent" End #end #else Public Class Flurry Function Init:Void(apiKey$) Print "Flurry Init" End Function Stop:Void() Print "Flurry Stop" End Function LogEvent:Void(eventName$) Print "Log: " + eventName End Function LogEventTimed:Void(eventName$) Print "Start Timed Event: " + eventName End Function EndTimedEvent:Void(eventName$) Print "End Timed Event: " + eventName End End #end [/monkeycode] |
| ||
flurry is getting ads. Will this monkey flurry module have that functionality? |
| ||
No. @Rus: Moving Flurry.Init( "<My Unique Application Key>" ) from Main to OnCreate should fix it. But I like your changes. Would you mind if I put them into my module directly? |
| ||
@maverick69 Sure thing! I'm looking at ways to get the event parameters working. I've been looking at your code as a basis for this. I think I've got it working in Android. I'm still trying to work out how to do it in iOS. Have you had any luck with this? I might be looking at developing an alternative to your Flurry module, with support for ads. I'll probably be doing it for myself first, but may release it for public consumption if it works out. |