Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
check which device is running — Gideros Forum

check which device is running

GiderosFanGiderosFan Member
edited October 2015 in General questions
hey guys,

i try to check out on which device the game is running.

How is the best solution to solve this.

I have tried with Application:getDeviceInfo is this right?

I just want create an function for checking.

for examplee:

if android then ...
if windows phone this
and if mac this
and windows this and so on.

Thank you in Advanced for the Help.

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    first value is always platform, so something like this works
    local platform =  string.lower(application:getDeviceInfo())
     
    if platform == "android" then
    elseif platform == "ios" then
    else --etc
    end

    Likes: GiderosFan

    +1 -1 (+1 / -0 )Share on Facebook
  • Awsome! Thank you very much @ar2rsawseen

    Works fantastic!
  • SinisterSoftSinisterSoft Maintainer
    Accepted Answer
    device={application:getDeviceInfo()}
    print(device[1])
    print(device[2])
    print(device[3])
    print(device[4])
    if device[1]=="Windows" or device[1]=="Mac OS" then
    	pc=true
    elseif device[1]=="Win32" then
    	win32=true
    elseif device[1]=="WinRT" then
    	winrt=true
    elseif device[1]=="Windows Phone" then
    	winrt=true
    elseif device[1]=="Android" then
    	android=true
    	if device[3]=="Amazon" then
    		kindle=true
    		if sub(device[4],1,3)=="AFT" then
    			tv=true
    			if device[4]=="AFTM" then
    				slow=true
    			end
    		end
    	elseif device[3]=="OUYA" then
    		ouya=true
    		tv=true
    		slow=true
    	elseif device[3]=="Geniatech" then
    		tv=true
    		if sub(device[4],1,9)=="GameStick" then
    			gamestick=true
    			slow=true
    		end
    	elseif device[3]=="HardKernel Co., Ltd." then
    		tv=true
    		hardkernel=true
    		if device[4]=="ODROIDC" then
    			odroidc=true
    		end
    	elseif device[4]=="Nexus Player" then
    		tv=true
    		nexusplayer=true
    	elseif device[3]=="razer" then
    		tv=true
    		razer=true
    		if device[4]=="Forge" then
    			forgetv=true
    		end
    	end
    elseif device[1]=="iOS" then
    	ios=true
    end

    Likes: GiderosFan, pie

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+2 / -0 )Share on Facebook
  • Thank you you guys for this quick and nice working solutions.
  • There may be a new one (tested) called "Web" in device[1]...

    ...if the html5 kickstarter is successful...

    Likes: hgy29, pie

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+2 / -0 )Share on Facebook
Sign In or Register to comment.