LogoLogo
6.1.1
6.1.1
  • TotalCross Overview
  • TotalCross Javadoc
  • TotalCross Changelog
  • Roadmap
  • Documentation
    • Getting Started
      • First embedded project with TotalCross
    • Components
      • Accordion
      • Aligned Labels
      • Button
      • Check
      • ComboBox
      • Dynamic Scroll
      • Edit
      • Floating Button
      • Gpiod
      • Grid
      • GridContainer
      • Image
      • ImageControl
      • ImageList
      • Label
      • Material Icons
      • Material Window
      • MessageBox
      • Multi Edit
      • Progress Bar
      • Progress Box
      • Radio
      • Radio Group
      • Scroll Container
      • Side Menu
      • Slider
      • Sliding Window
      • Spin List
      • Spinner
      • Switch
      • Tabbed Container
      • Velocimeter
    • APIs
      • API Overview
      • API Rest
      • Asynchronous Task
      • Camera
      • Control
        • Main Window
        • Window
        • Container
      • GPS
      • HTTPS and SSL
      • JSON
      • Maps
        • Maps - Deprecated
        • Static Map
      • Material Design Standards
      • Ninepath
      • Notifications
      • PrinterManager
      • Push Notification Firebase
      • Scanner
      • SOAP
      • Socket
      • SocketServer
      • SQLite Encryption
      • QR Code Generator
      • totalcross.sys
      • Youtube API
    • Creating an Issue
    • Contributing
      • Branch workflow
      • Writing documentation
    • Guides
      • App Architecture
        • Suggested Architecture
        • Why do Design Patterns help with the application's organization?
          • MVC Architecture Pattern
          • Template Pattern
          • Data Persistence: DAO Pattern.
        • Separation of concepts: What is the best way to create UI interfaces?
        • Positioning
          • Manual Positioning
        • Relative Positioning
        • Best practices to improve project maintenance
      • Device Simulator
      • Package your app from scratch
        • TotalCross SDK
        • Environment Variables in IDE
          • Eclipse
          • IntelliJ
        • Deploy your app with a dependecy TC
        • Deploy iOS
          • Using Development certificate to test your apps
      • Understanding TotalCross for Linux ARM
      • Running C++ applications with TotalCross
      • Web Services
    • Miscelaneous
      • Java JDK 8
      • Maven
      • Installing Visual Studio Code
    • FAQ
      • IMEI in Android 10
Powered by GitBook
On this page
  • How are people going around this?
  • What we recommed: Token based authentication

Was this helpful?

  1. Documentation
  2. FAQ

IMEI in Android 10

PreviousFAQ

Last updated 5 years ago

Was this helpful?

"IMEI is short for International Mobile Equipment Identity and is a unique number given to every single mobile phone, typically found behind the battery. IMEI numbers of cellular phones connected to a GSM network are stored in a database (EIR - Equipment Identity Register) containing all valid mobile phone equipment."

As of Android 10 (API Level 29) Google has dropped support to getImei(). This decision was taken because of their privacy policy, on this API Level, third parties - us - can't use it anymore. Thus, from the TotalCross ethical point of view, we can't provide access to this information through our Android VM's anymore. Despite this can cause some issues with the way some TotalCross applications uses IMEI to identify end users, these same users can feel more secure, knowing his privacy is kept safe. You can find more info here: .

Thus, in the next session we are going to show some alternatives to the IMEI in regarding to deal with the problem of identifying end users.

How are people going around this?

Random ID generator

This one is pretty simple, but also not so effective, you just need to generate a random number and check with your database if there's no other device with that ID, then you just set the new device ID as the random number. This solution is easy to implement but it requires a backend solution.

Mobile Device Management

For this you normally need a software solution that has management features for private mobile device vendors and as of yet, TotalCross does not support the MDM implementation. If you believe that it is necessary to implement this feature, please .

What we recommed: Token based authentication

Whenever a new user tries to use your application, you should generate a token for that device, this will allow you to see who's using your application at any given moment, for this you should implement an authentication service on your backend, this service should return a token String if the login is successful. For the storage of the token we recommend you use .

How to use it in TotalCross

Get the token from server, then store it on the device.

public boolean doLogin(username, password) {
    String tokenValue = doLogin(username, password);
    String sqliteRequest = "insert into userSettings values(?, ?)";
    PreparedStatement ps = dbConnection.prepareStatement(sqliteRequest);
    ps.setString(1, "token");
    ps.setString(2, tokenValue);
    ps.executeUpdate();
    ps.close();
    User user = getUserResources(tokenValue);
    if(tokenValue != null) {
        return true;
    } else {
        return false; // Wrong credentials, invalid login or password
    }
}

Get the token from device and get the user info.

public boolean doLoginFromStoredToken() {
    Statement st = deConnection.createStatement();
    ResultSet rs = st.executeQuery("select * from userSettings");
    String token;
    if(rs.next()) {
        token = rs.getString("token");
        User user = getUserResources(token);
        return true;
    } else {
        return false; //Swap to login screen
    }
}

https://developer.android.com/about/versions/10/privacy/changes#randomized-mac-addresses
contact us
SQLite