SystemStats::getDeviceDescription implementation


#1

Hi Jules, I needed the MODEL + SERIAL info from my phone, so I implemented that in juce_android_SystemStats.cpp:

namespace AndroidStatsHelpers
{

...

    #define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD)
    DECLARE_JNI_CLASS (BuildClass, "android/os/Build");
    #undef JNI_CLASS_MEMBERS
    String getAndroidOsBuildValue(const String& field)
    {
        return juceString (LocalRef<jstring> ((jstring) getEnv()->GetStaticObjectField (
            BuildClass,
            getEnv()->GetStaticFieldID(BuildClass, field.toRawUTF8(), "Ljava/lang/String;")
            )));
    }
...

}

String SystemStats::getDeviceDescription()
{
    return AndroidStatsHelpers::getAndroidOsBuildValue("MODEL") + "-" + AndroidStatsHelpers::getAndroidOsBuildValue("SERIAL");
}

 


#2

Nice, thanks! Will add asap..