Thursday, June 30, 2016

[Android] Pupillary distance measurements in your app using Pupil Distance Meter.

Pupil Distance Meter (PDM) can be called now from your app to get PD measurements. See code example below for details how to use it.

How to call from your application:

Intent intent = new Intent("com.vistechprojects.pupildistancemeter.action.MEASURE_PD");
intent.setDataAndType(IMAGE_SOURCE_URI, "image/*"); // comment this line if you don't pass image uri
startActivityForResult(intent, REQUEST_CODE); // replace REQUEST_CODE with your constant

Example how to get results:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

if (resultCode == RESULT_OK && requestCode == REQUEST_CODE){
     JSONObject json = new JSONObject(data.getStringExtra("PDM_OUTPUT_JSON"));

JSON returned from Pupil Distance Meter: 

{"APP_RESULTS":{"pd":"67", "right eye":"33.5", "left eye":"33.5", "units":"mm"}}

Pupil Distance Meter Android app on Google Play

No comments:

Post a Comment