1. Ce site utilise des cookies. En continuant à utiliser ce site, vous acceptez l'utilisation des cookies. En savoir plus.
  2. Bonjour tout le monde ! Veillez consulter la Politique de forum pour comprendre nos règles, Merci a vous !
    Rejeter la notice

Unique Serial Number/Identification of Mobile

Discussion dans 'Windev Mobile' créé par sanyad, Jan 19, 2021.

  1. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    H friends, I am developing an official app for my organization which has confidential data to share. I want to allow only unique mobiles to use that android apk file through server-side coding. Is there any parameter in windev mobile 24/25 to detect any unique serial number (Like HDD serial of PC) of mobile and allow that serial number on a server-side database? In case the serial number is not allowed in the database, the android mobile will not be allowed to access confidential data?
     
    Tags:
  2. popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    Read this page

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!


    It's write
    On Android 10
    It is no longer possible to get a unique device identifier with SysIMEI and SysSerialNum. "Device owner" applications are not affected by this restriction.
    You Can try code of boller in java

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!


    Or

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

     
  3. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    thanks

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    . GetGUID function generate distict strings during each execution so can not be linked.
     
    #3 sanyad, Jan 20, 2021
    Dernière édition: Jan 20, 2021
  4. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    I used following but still I can't get IMEI although get other information about phone like model/manufacturer/kernal etc..


    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;
    }
    }


    Any suggestion to get IMEI?
     
  5. popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    Il Can read in java code of boller
    In
    CelularDadosGerais function

    //Retorna o ID único dispositivo, por exemplo, o IMEI para o GSM eo MEID ou ESN para celulares CDMA.
    String IMEI = tm.getDeviceId();
     
  6. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    USed :

    ''''''''''''''''============
    import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.content.SharedPreferences.Editor;
    import android.os.Bundle;
    import android.telephony.TelephonyManager;
    import android.util.Log;
    import android.widget.Toast;
    import android.provider.Settings.Secure;

    //Android Manisfest
    //<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    //Requires READ_PHONE_STATE uses-permission

    public static String RetornoNumCelular1()
    {

    TelephonyManager tm;
    tm= (TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
    String RetornoNumCelular= tm.getDeviceId();
    return RetornoNumCelular;

    }


    I am calling RetornoNumCelular1() function as

    info(RetornoNumCelular1())
    but showing error:
    "System message =getDeviceId: The user 10653 does not meet the requirements to access device identifiers."
     
  7. popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    I do not know
     
  8. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    No issue. We can try. I will post the solution as soon as I find it. Thanks

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

     
  9. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Got a solution at:

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!


    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!


    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!



    Using MediaDrm API for Unique identification of a Mobile:

    I used the following Code (Javascript) and called as getUniqueID () in the form as and when I need to get uniqueID which is looking promising as Google API banned IMEI fetch in a conventional way.

    import android.media.MediaDrmException;
    import java.lang.ref.WeakReference;
    import android.media.MediaDrm;
    import java.security.MessageDigest;
    import java.util. *;
    import java.util.UUID;

    public static String getUniqueID () {
    UUID wideVineUuid = new UUID (-0x121074568629b532L, -0x5c37d8232ae2de13L);
    try {
    MediaDrm wvDrm = new MediaDrm (wideVineUuid);
    byte [] wideVineId = wvDrm.getPropertyByteArray (MediaDrm.PROPERTY_DEVICE_UNIQUE_ID);
    return Arrays.toString (wideVineId);
    // String mn = Arrays.toString (wideVineId);
    // return mn.replaceAll (",", "");
    // return Base64.encodeToString (wideVineId, Base64.Default)
    // var encodedString: String = Base64.encodeToString (id, Base64.DEFAULT)
    } catch (Exception e) {
    // Inspect exception
    return null;
    }
    // Close resources with close () or release () depending on platform API
    // Use ARM on Android P platform or higher, where MediaDrm has the close () method
    }
     
    #9 sanyad, Jan 20, 2021
    Dernière édition: Jan 20, 2021
  10. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    UUID method shown above is also not reliable as every update of apk causing a change of UUID.
     
  11. commun

    commun Active Member
    MEMBRE WX

    Inscrit:
    Jan 1, 2018
    Messages:
    225
    J'aime reçus:
    110

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    thanks

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    . GetGUID function generate distict strings during each execution so can not be linked.
    Cliquez pour agrandir...
    you can use GetGuid function and save with saveparameter() and loas with loadparameter()

    [windev]
    varUUID is an UUID=loadparameter("varUUID","00000000-0000-0000-0000-000000000000")

    if varUUID="00000000-0000-0000-0000-000000000000" then
    SaveParameter("varUUID",GetGuid())
    end[/windev]
     
  • trick

    trick Active Member
    MEMBRE WX DUMP TEAM

    Inscrit:
    Jan 1, 2018
    Messages:
    169
    J'aime reçus:
    95
    Salut

    Perso j'utilsie cela et cela fonctionne nickel

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

     
  • commun

    commun Active Member
    MEMBRE WX

    Inscrit:
    Jan 1, 2018
    Messages:
    225
    J'aime reçus:
    110
    meme principe mais avec un fichier.
     
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Thanks a lot Dear Friends

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    &

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    for sharing the info. May God bless u.
     
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Dear

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    , following code:
    [windev]
    varUUID is an UUID=loadparameter("varUUID","00000000-0000-0000-0000-000000000000")
    if varUUID="00000000-0000-0000-0000-000000000000" then
    SaveParameter("varUUID",GetGuid())
    end[/windev]


    The issue is that the saveparameter will be empty after closing the app in android and during next time u run the app, it loadparameter will show empty string.
    saveparameter & loadparameter works only if the app is not closed.

    Any suggestion?
     
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    In addition to above SysIndetifier() command is also said to be unique.
    Just checking and report back soon.
     
  • commun

    commun Active Member
    MEMBRE WX

    Inscrit:
    Jan 1, 2018
    Messages:
    225
    J'aime reçus:
    110

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    Dear

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    , following code:
    [windev]
    varUUID is an UUID=loadparameter("varUUID","00000000-0000-0000-0000-000000000000")
    if varUUID="00000000-0000-0000-0000-000000000000" then
    SaveParameter("varUUID",GetGuid())
    end[/windev]


    The issue is that the saveparameter will be empty after closing the app in android and during next time u run the app, it loadparameter will show empty string.
    saveparameter & loadparameter works only if the app is not closed.

    Any suggestion?
    Cliquez pour agrandir...
    you must use initaparameter() before to save parameters in a file, the file is then used by loadparameter when you launch the application.
     
  • Partager cette page

    Chargement...