Start a new topic

Android: Is current device ARchitect compatible?

Android: Is current device ARchitect compatible?


Hi there!

Since it is a question asked quite frequently, here is the recommended programmatical check to find out if there is a feature missing on the device your ARchitect-SDK is deployed at.

1. Set the following in your Manifest

<uses-permissionandroid:name="android.permission.INTERNET"/>
<uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permissionandroid:name="android.permission.ACCESS_GPS"/>
<uses-permissionandroid:name="android.permission.CAMERA"/>
<uses-permissionandroid:name="android.permission.INTERNET"/>
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permissionandroid:name="android.permission.READ_PHONE_STATE"/> <!-- required for ImageRecognition only -->



2. Create this helper Method somewhere in your code, so you can check requirements manually.
If you want to run your app also on devices without all requirements:


remove affected entries in manifest

disable ARchitect-cam for unsupported devices using the following helper-function


 

public static boolean checkARchitectRequirements( final Context context ) {


 

final LocationManager locationManager = (LocationManager)context.getSystemService( Context.LOCATION_SERVICE );


final SensorManager sensorManager = (SensorManager)context.getSystemService( Context.SENSOR_SERVICE );


 

/* digital compass */


final boolean hasCompass = sensorManager != null && sensorManager.getDefaultSensor( Sensor.TYPE_MAGNETIC_FIELD ) != null;


 

/* GPS sensor */


final boolean hasGPS = locationManager != null && locationManager.getAllProviders() != null && locationManager.getAllProviders().size() > 0;


 

/* openGL-API version for rendering */


final boolean hasOpenGL20 = ((ActivityManager)context.getSystemService( Context.ACTIVITY_SERVICE )).getDeviceConfigurationInfo().reqGlEsVersion >= 0x20000;


 

/* Android SDK version */


final boolean hasSDK8plus = Build.VERSION.SDK_INT >= 8;


 

/* rear cam */


final boolean hasRearCam = context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_CAMERA );


 

/* all requirements fulfilled? */


final boolean hasAllRequirements = hasCompass && hasGPS && hasOpenGL20 && hasSDK8plus && hasRearCam;


 

Log.i( "All requirements fulfilled? ", String.valueOf( hasAllRequirements ) );


Log.i( "Device features available", "Compass: " + hasCompass + "; GPS: " + hasGPS + "; OpenGL 2.0: " + hasOpenGL20 + "; SDK 8+: " + hasSDK8plus + "; Rear Cam: " + hasRearCam + ";" );


 

return hasAllRequirements;


}

 

Cheers, Andi

Hi Andreas,

Maybe this method should complement/replace the isDeviceSupported() method in the SDK?

Hi there!

Yepp - You're right. You can even use it instead.
But sometimes you wanna know what's exactly missing. That code snippet allows you to find out more.

Cheers,
Andi

Indeed, my 2nd suggestion is (if you decide to put this into SDK) to return the list of missing features instead of boolean, where empty list would mean the full compatibility.

;)

Hello !

I know it's been four year since the last post, but would there be any way to have the same kind of code as in the first post of this thread but for the Cordova Wikitude Plugin ?

I have one a the device on which I test my app that seems to miss something. But I can't figure out what this is since the isDeviceSupported() method only returns a String...

Being able to test each and every hardware requirements would be higly welcome.

I also second the suggestion by Yegor that a the isDeviceSupported method returns exactly what's missing. This would make much more sense.

Thanks in advance !

Mathias

 

Hi Mathias,
Currently we don't have such a snippet for Cordova, but we're planning to update the isDeviceSupported method accross all Android SDKs + extensions in an upcoming release.

For now the only way would be that you write your own Cordova plugin containing the code from this thread.

Best regards,

Andreas

Hi Andrea

I'm glad to hear that you will improve the isDeviceSupported() method. That's a very good news :)

Thanks for your answer,

Mathias
Login or Signup to post a comment