You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Matt Baxter-Reynolds (JIRA)" <ji...@apache.org> on 2012/10/24 09:50:14 UTC

[jira] [Created] (CB-1702) device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID

Matt Baxter-Reynolds created CB-1702:
----------------------------------------

             Summary: device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID
                 Key: CB-1702
                 URL: https://issues.apache.org/jira/browse/CB-1702
             Project: Apache Cordova
          Issue Type: Bug
          Components: Windows 8
            Reporter: Matt Baxter-Reynolds
            Assignee: Jesse MacFadyen


The current implementation creates a device ID and puts it in localStorage:

        // deviceId aka uuid
        var deviceId = localStorage.deviceId;
        if(!deviceId) {
            deviceId = utils.createUUID();
            console.log(deviceId);
            localStorage.deviceId = deviceId;
        }

This should more properly use WinRT's HardwareIdentification class, e.g.

private string GetHardwareId()
{
var token = HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);

byte[] bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);

return BitConverter.ToString(bytes);
}

(I appreciate that's C# - I've cribbed it from another project, but this should work in WinJS.)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1702) device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID

Posted by "Jesse MacFadyen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13483116#comment-13483116 ] 

Jesse MacFadyen commented on CB-1702:
-------------------------------------

We have to be careful because the packageSpecificToken may be affected by hardware changes, including docking/undocking, adding removing usb devices, ...

Generating our own id and storing it in a persistent location is probably 'good enough' as there is no need to identify an app/device beyond an un-install.
The uuid should however survive an application update.

My advice is to move the uuid from localStorage which can be wiped simply by calling localStorage.clear() to a known file on the filesystem.
ie.
on load, synchronously check if the file 'appDeviceIdentifier.txt' exists
if so, read it's string uuid value and use it,
otherwise, generate a uuid, and write it to the file 'appDeviceIdentifier.txt'



                
> device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID
> -------------------------------------------------------------------------------------------
>
>                 Key: CB-1702
>                 URL: https://issues.apache.org/jira/browse/CB-1702
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Windows 8
>            Reporter: Matt Baxter-Reynolds
>            Assignee: Jesse MacFadyen
>
> The current implementation creates a device ID and puts it in localStorage:
>         // deviceId aka uuid
>         var deviceId = localStorage.deviceId;
>         if(!deviceId) {
>             deviceId = utils.createUUID();
>             console.log(deviceId);
>             localStorage.deviceId = deviceId;
>         }
> This should more properly use WinRT's HardwareIdentification class, e.g.
> private string GetHardwareId()
> {
> var token = HardwareIdentification.GetPackageSpecificToken(null);
> var hardwareId = token.Id;
> var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
> byte[] bytes = new byte[hardwareId.Length];
> dataReader.ReadBytes(bytes);
> return BitConverter.ToString(bytes);
> }
> (I appreciate that's C# - I've cribbed it from another project, but this should work in WinJS.)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CB-1702) device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID

Posted by "Jesse MacFadyen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen resolved CB-1702.
---------------------------------

    Resolution: Fixed

This was addressed in 2.2.0
                
> device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID
> -------------------------------------------------------------------------------------------
>
>                 Key: CB-1702
>                 URL: https://issues.apache.org/jira/browse/CB-1702
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Windows 8
>            Reporter: Matt Baxter-Reynolds
>            Assignee: mingfeng.wang
>
> The current implementation creates a device ID and puts it in localStorage:
>         // deviceId aka uuid
>         var deviceId = localStorage.deviceId;
>         if(!deviceId) {
>             deviceId = utils.createUUID();
>             console.log(deviceId);
>             localStorage.deviceId = deviceId;
>         }
> This should more properly use WinRT's HardwareIdentification class, e.g.
> private string GetHardwareId()
> {
> var token = HardwareIdentification.GetPackageSpecificToken(null);
> var hardwareId = token.Id;
> var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
> byte[] bytes = new byte[hardwareId.Length];
> dataReader.ReadBytes(bytes);
> return BitConverter.ToString(bytes);
> }
> (I appreciate that's C# - I've cribbed it from another project, but this should work in WinJS.)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (CB-1702) device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID

Posted by "Jesse MacFadyen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen reassigned CB-1702:
-----------------------------------

    Assignee: mingfeng.wang  (was: Jesse MacFadyen)
    
> device.uuid should use HardwareIdentification.GetPackageSpecificToken, not utils.createUUID
> -------------------------------------------------------------------------------------------
>
>                 Key: CB-1702
>                 URL: https://issues.apache.org/jira/browse/CB-1702
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Windows 8
>            Reporter: Matt Baxter-Reynolds
>            Assignee: mingfeng.wang
>
> The current implementation creates a device ID and puts it in localStorage:
>         // deviceId aka uuid
>         var deviceId = localStorage.deviceId;
>         if(!deviceId) {
>             deviceId = utils.createUUID();
>             console.log(deviceId);
>             localStorage.deviceId = deviceId;
>         }
> This should more properly use WinRT's HardwareIdentification class, e.g.
> private string GetHardwareId()
> {
> var token = HardwareIdentification.GetPackageSpecificToken(null);
> var hardwareId = token.Id;
> var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
> byte[] bytes = new byte[hardwareId.Length];
> dataReader.ReadBytes(bytes);
> return BitConverter.ToString(bytes);
> }
> (I appreciate that's C# - I've cribbed it from another project, but this should work in WinJS.)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira