Skip to content

Inconsistent device data from same device when detected from browser vs app. #59

@rolinger

Description

@rolinger

Both my website and my app report to my server, using the HTTP_USER_AGENT to do device detection. But I am getting very different results.

use fiftyone\pipeline\devicedetection\DeviceDetectionCloud;
use fiftyone\pipeline\core\PipelineBuilder;
use fiftyone\pipeline\core\Logger;
use fiftyone\pipeline\cloudrequestengine\CloudRequestEngine;

function checkDevice() {
  $key = "....." ; // 
  $domains = "mydomain.com" ;
  $cloudRequestEngine = new CloudRequestEngine(array("resourceKey"=>$key,"cloudRequestOrigin"=>$domains));
  $deviceDetection = new DeviceDetectionCloud(array());  
  
  $Pipeline = (new PipelineBuilder())
              ->add($cloudRequestEngine)
              ->add($deviceDetection)
              ->build();
  $FlowData = $Pipeline->createFlowData();
  
  $FlowData->evidence->set("header.user-agent",$_SERVER['HTTP_USER_AGENT']);  
  // Process the FlowData
  $FlowData->process();
  $hwModel = checkProperty($FlowData->device->hardwaremodel) ;
  $hwName =  checkProperty($FlowData->device->hardwarename) ;
  //$hwVendor = checkProperty($FlowData->device->hardwarevendor) ;
  //$hwCarrier = checkProperty($FlowData->device->hardwarecarrier) ;
  return array($hwModel,$hwName) ;
}

function checkProperty($property) {
  if($property->hasValue)  {
    return var_export($property->value, true);
  }
  return var_export($property->noValueMessage, true);
}

Using Chrome, my website device detection reports:

  • // $hwModel = 'Generic Android' ;
  • // $hwName = array ( 0 => 'Generic Android') ;

But on the same android phone, my app connects to my server and also does a device detection off of HTTP header:

  • // $hwModel = "SM-F721U" ;
  • // $hwName = array (0 => 'Galaxy Z Flip4') ;

I think its awesome that its getting my actual phone type from my app which is using cordova-plugin-ionic-webview, but I am surprised using the regular Chrome browser returns nothing relevant that I can use.

What is the issue here, why I am getting generic android from Chrome? What else can I do to get a browser hitting my website to report correctly?

As well, I had to edit out the two lines:

  //$hwVendor = checkProperty($FlowData->device->hardwarevendor) ;
  //$hwCarrier = checkProperty($FlowData->device->hardwarecarrier) ;

because it was throwing errors on them, are they no longer supported?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions