detect iphone & ipad version

  • Hi, is there a way to detect in the iphone is a version 3, 3gs or 4 and a ipad 1 or 2 ?
    I ask this because I would like to include a button to enable/disable gyro for iphone 4 and ipad 2 and a button to enable/disable autorotation for iphone 3 & 3gs & ipad 1...

    Thanx !

  • Hi,

    no, currently there is no way for that,
    but the gyroscope plugin has a available attribute which could be checked,

    e.g. here an example usage:

    Code
    <plugin name="gyro" alturl="gyro.js" ... onloaded="delayedcall(1,if(available, trace(gryo available), trace(gryo not avaiable)));" />


    best regards,
    Klaus

  • Cool, thant Klaus !!!

    Just to understand your example (gyro available) & (gyro no available) are actions I can build ?

    Hi,

    no, currently there is no way for that,
    but the gyroscope plugin has a available attribute which could be checked,

    e.g. here an example usage:

    Code
    <plugin name="gyro" alturl="gyro.js" ... onloaded="delayedcall(1,if(available, trace(gryo available), trace(gryo not avaiable)));" />


    best regards,
    Klaus

  • I'm not great at coding but I've come across this and wonder if I can modify it to only make my 'gyro on/off' button available if it's a gyro enabled device?

    My current gyro code:

    Code
    <plugin name="gyro" url="gyro.js" enabled="true" camroll="true" friction="0.5" velastic="0.2" devices="html5" keep="true" />

    The button I am using that appears on all iphones/ipads but I want to ONLY appear on gyro enabled:

    How would I re-write this please so it detects?

    Thanks,
    Adrian

  • You can detect if the gyroscope is available onloaded :

    Code
    <plugin name="gyro" url="gyro.js" keep="true" enabled="false" camroll="true" friction="0.5" velastic="0.2" onloaded="delayedcall(2,if(available, gyroscope, nogyroscope));" devices="iphone|ipad"/><action name="gyroscope">
    set(plugin[gyro].enabled,true);
    set(plugin[pausegyro].visible,true);
    </action><action name="nogyroscope">
    set(autorotate.enabled,true);
    set(plugin[pauseiphone].visible,true);
    </action>

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!