robbywh
robbywh

Reputation: 323

show deviceId on MobileFirst application

I can download logs file via analytics console > Devices > Device Search > Device Information > Download Logs

we can search the logs file by deviceId.

My question is How to know the deviceid from the user ??

For example, there is some problem on the application, the user reports to the admin, and the admin searchs the user device by deviceId.

Is there a code to display deviceId on my application, so the user can send the deviceId to the admin ??

Upvotes: 0

Views: 136

Answers (2)

Srik
Srik

Reputation: 7957

Of course, there is a JavaScript API to get the Device ID.

See WL.Device.getID()

Upvotes: 2

djna
djna

Reputation: 55907

I have seen folks use code like this in Native apps and have some special view to show it t the user

 NSUUID *oNSUUID = [[UIDevice currentDevice] identifierForVendor];

or

import android.provider.Settings.Secure;
private String android_id = 
    Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);

I have not found an example of this API in JavaScript, but it is very easy to pass the data up from native, for example

in main.m #import "WL.h"

  NSDictionary *data = @{@"id": oNSUUID};
    [[WL sharedInstance] sendActionToJS:@"DeviceInfo"             
                   withData:data];

in your app

       //global
       var nativeInfo = null;

  // in wlCommonInit()

var actionReceiver = function(received){
      WL.Logger.error(received);
      if ( received.action == "DeviceInfo"){
          nativeInfo = received.data; 
      }

};

WL.App.addActionReceiver ("GarantiActionReceiver", actionReceiver);

Upvotes: 0

Related Questions