4 Replies Latest reply on May 29, 2014 2:35 PM by Marcus Atkins

    Uniquely Identify a device in RMS 4.1

    Marcus Atkins

      I need to uniquely identify a device. Is there a way yet as reading previous posts by people that there was no generic cross platform way of doing this without writing an extension to Rhomobile.

       

      Any help will be much appreciated.

        • Re: Uniquely Identify a device in RMS 4.1
          Bart Fukkink

          Hey Marcus,

           

          Maybe this code sample from our application helps:

           

          # No id in settings, get it.  
          id = Rho::System.phoneId
          # Or create one.
          if( id.nil? || id.length == 0 )
            id = [
              sprintf( '%08x',  rand( 0x100000000 ) ),
              sprintf( '%04x',  rand( 0x10000 ) ),
              sprintf( '%04x',  rand( 0x10000 ) ),
              sprintf( '%04x',  rand( 0x10000 ) ),
              sprintf( '%012x', rand( 0x1000000000000 ) )
            ].join( '-' )
          end
          

           

          First we check our Settings table if we created an device id before. If this is not the case we try and get the phoneId provided by the System API. Should this one not be available aswell, then we create an unique one. An example of the created device id is: "d6bcde2b-7f8e-de32-7bc9-95f6345525f7"


          After this code is executed, we save the id in the database, and the next time we get the saved value from the database.


          This way you have an unique identifier (if it can find the phoneId, since that is hardware based) or an id that is created and is often unique, but it can differ through different application installs.

           

          I hope this can help you a bit.

           

          Bart

          1 of 1 people found this helpful
          • Re: Uniquely Identify a device in RMS 4.1
            Jon Tara

            Note that iOS does not support the use of truly unique device IDs by apps. At one time it did. Currently, iOS supports per-app unique IDs. (Uninstalling and reinstalling the app, though, gets a new ID.)

             

            Attempting to create your own (hardware-derived) unique ID will gamer a ban from the App Store if discovered by Apple.

             

            That said, generating a random ID and sending it back to a database should satisfy Apple's requirements.

            1 of 1 people found this helpful
            • Re: Uniquely Identify a device in RMS 4.1
              Kutir Mobility

              Marcus,

              Have you tried f4d106fb-bfbe-4296-b4da-5d2b6912f497 response?

               

               

              Visnupriya R

              Kutir Mobility