函数:getDeviceType 获取设备类型

函数名称:获取设备类型

函数功能:获取设备的类型,可使用获取屏幕分辨率代替

引擎版本:iOS v1.0,Android v1.3.0 以上版本

函数方法

kind = getDeviceType()

返回值 类型 说明
kind number 设备类型:
0 - iPod Touch;
1 - iPhone;
2 - iPad;
3 - 安卓真机;
4 - 安卓模拟器
name string 设备类型为模拟器时返回具体模拟器名称,非模拟器时没有该参数。
模拟器名称 返回值
逍遥模拟器 逍遥
海马玩模拟器 Droid4X
夜神模拟器 nox
猩猩模拟器 x86
猩猩模拟器畅玩版 klte
天天模拟器 ttVM_Hdragon

函数用例

types = getDeviceType(); 
if types == 0 then
    dialog("当前设备为 iPod Touch")
elseif types == 1 then
    dialog("当前设备为 iPhone",5)
elseif types == 2 then
    dialog("当前设备为 iPad",5)
elseif types == 3 then
    dialog("当前设备为安卓真机")
elseif types == 4 then
    dialog("当前设备为安卓模拟器",5) 
end
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""