|
GRUPOS DE DISCUSSÃO PROFISSIONAL WINDEV, WEBDEV e WINDEV Mobile |
| | | | | |
Inicio → WINDEV 25 → WM - Saber se o aplicativo esta rodando em um tablet e nao em um celular |
WM - Saber se o aplicativo esta rodando em um tablet e nao em um celular |
Iniciado por Boller, abr., 06 2015 11:21 PM - Sem resposta |
| |
| | | |
|
| |
Membro registado 4.520 mensagems |
|
Publicado em abril, 06 2015 - 11:21 PM |
IF isTable() = False EndProgram() END
Procedure GLOBAL Java
############################################################################ import android.content.res.Configuration;
PUBLIC static boolean isTablet(){ RETURN (getApplicationContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; } ############################################################################
OU pelo Modelo modelo is string = getDeviceName() ############################################################################# Procedure GLOBAL Java
import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.*; import android.os.Bundle; import android.telephony.TelephonyManager; import android.util.Log; import android.widget.Toast; import android.provider.Settings.Secure;
PUBLIC static string getDeviceName() {
string manufacturer = android.os.Build.MANUFACTURER; string model = android.os.Build.MODEL; string brand = android.os.Build.BRAND; string product = android.os.Build.PRODUCT; string board = android.os.Build.BOARD; string bootloader = android.os.Build.BOOTLOADER; string cpu_abi = android.os.Build.CPU_ABI; string cpu_abi2 = android.os.Build.CPU_ABI2; string device = android.os.Build.DEVICE; string display = android.os.Build.DISPLAY; string fingerprint = android.os.Build.FINGERPRINT; string hardware = android.os.Build.HARDWARE; string host = android.os.Build.HOST; string id = android.os.Build.ID; string radio = android.os.Build.RADIO; string serial = android.os.Build.SERIAL; string tags = android.os.Build.TAGS; string type = android.os.Build.TYPE; string user = android.os.Build.USER;
IF (model.startsWith(manufacturer)) { RETURN (model); } ELSE { string MarcaModeloCelular = "manufacturer: " + (manufacturer) + "; model: " + (model) + "; brand: " + (brand) + "; product: " + (product) + "; board:" + (board) + "; bootloader: " + (bootloader) + "; cpu_abi: " + (cpu_abi) + "; cpu_abi2: " + (cpu_abi2) + "; device: " + (device) + "; display: " + (display) + "; fingerprint: " + (fingerprint) + "; hardware: " + (hardware) + "; host: " + (host) + "; id: " + (id) + "; radio: " + (radio) + "; serial: " + (serial) + "; tags: " + (tags) + "; type: " + (type) + "; user: " + (user);
MarcaModeloCelular = MarcaModeloCelular.toUpperCase();
RETURN MarcaModeloCelular; } } #############################################################################
OU pela resolução
Procedure Resolucao()
ResHorizRes is int = SysXRes() gloResHorizRes = ResHorizRes
ResVertRes is int = SysYRes() gloResVertRes = ResVertRes
Retorno is string = ResHorizRes +"X"+ ResVertRes
W = gloResHorizRes H = gloResVertRes IF H = 1920 AND W = 1080 THEN gnCentroY = 1530 gnCentroYinitial = 1050 ELSE IF H = 800 AND W = 480 THEN gnCentroY = 605 gnCentroYinitial = 525 ELSE IF H = 800 AND W = 1280 THEN gnCentroY = 1070 gnCentroYinitial = 319 END
RESULT(Retorno) |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|