You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Cristian Spiescu <cr...@gmail.com> on 2013/06/07 21:32:51 UTC

Determine at runtime if the application is running on mobile

Hello,

I'd like to know at runtime, if the current application is running in 
web mode (in browser) or as mobile app.
Is there some kind of property that I can use?

I have looked at Capabilities class, but I'm not sure it helps. I see 
that there is a "playerType" setting, but it doesn't seem to 
differentiate AIR from AIR on mobile.

Thanks in advance,
Cristian.

Re: Determine at runtime if the application is running on mobile

Posted by Cristian Spiescu <cr...@gmail.com>.
Thanks Lee!

I will use this as well.

Cristian.

On 07.06.2013 21:36, Lee Burrows wrote:
> This is my mobile/web check:
>
> var playerType:String = Capabilities.playerType.toUpperCase();
> var version:String = Capabilities.version.substr(0, 3).toUpperCase();
>
> isMobile = (playerType=="DESKTOP" && (version=="IOS" || version=="AND" 
> || version=="QNX"));
> isWeb = (playerType=="ACTIVEX" || playerType=="PLUGIN");
>
> Not necessarily the most efficient, but it works.
>
>
>
> On 07/06/2013 20:32, Cristian Spiescu wrote:
>> Hello,
>>
>> I'd like to know at runtime, if the current application is running in 
>> web mode (in browser) or as mobile app.
>> Is there some kind of property that I can use?
>>
>> I have looked at Capabilities class, but I'm not sure it helps. I see 
>> that there is a "playerType" setting, but it doesn't seem to 
>> differentiate AIR from AIR on mobile.
>>
>> Thanks in advance,
>> Cristian.
>>
>
>


Re: Determine at runtime if the application is running on mobile

Posted by Lee Burrows <su...@leeburrows.com>.
This is my mobile/web check:

var playerType:String = Capabilities.playerType.toUpperCase();
var version:String = Capabilities.version.substr(0, 3).toUpperCase();

isMobile = (playerType=="DESKTOP" && (version=="IOS" || version=="AND" 
|| version=="QNX"));
isWeb = (playerType=="ACTIVEX" || playerType=="PLUGIN");

Not necessarily the most efficient, but it works.



On 07/06/2013 20:32, Cristian Spiescu wrote:
> Hello,
>
> I'd like to know at runtime, if the current application is running in 
> web mode (in browser) or as mobile app.
> Is there some kind of property that I can use?
>
> I have looked at Capabilities class, but I'm not sure it helps. I see 
> that there is a "playerType" setting, but it doesn't seem to 
> differentiate AIR from AIR on mobile.
>
> Thanks in advance,
> Cristian.
>


-- 
Lee Burrows
ActionScripter