From 6f3c94f33faeeb784c67cce7fda3f9bc261719f8 Mon Sep 17 00:00:00 2001 From: r4ravi2008 Date: Thu, 12 Nov 2015 14:58:54 -0800 Subject: [PATCH] release-ancha, fix motion tracking permissions --- .../javapointcloud/PointCloudActivity.java | 2 +- .../app/src/main/AndroidManifest.xml | 4 +- .../videooverlaysample/MainActivity.java | 42 ++++++++----------- .../app/src/main/res/values/strings.xml | 4 ++ 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/PointCloudJava/app/src/main/java/com/projecttango/experiments/javapointcloud/PointCloudActivity.java b/PointCloudJava/app/src/main/java/com/projecttango/experiments/javapointcloud/PointCloudActivity.java index 47480820..18065b42 100644 --- a/PointCloudJava/app/src/main/java/com/projecttango/experiments/javapointcloud/PointCloudActivity.java +++ b/PointCloudJava/app/src/main/java/com/projecttango/experiments/javapointcloud/PointCloudActivity.java @@ -148,6 +148,7 @@ protected void onResume() { try { mTango.connect(mConfig); mIsTangoServiceConnected = true; + setupExtrinsics(); } catch (TangoOutOfDateException outDateEx) { if (mTangoUx != null) { mTangoUx.showTangoOutOfDate(); @@ -156,7 +157,6 @@ protected void onResume() { Toast.makeText(getApplicationContext(), R.string.TangoError, Toast.LENGTH_SHORT) .show(); } - setupExtrinsics(); Log.i(TAG, "onResumed"); } diff --git a/VideoOverlaySample/app/src/main/AndroidManifest.xml b/VideoOverlaySample/app/src/main/AndroidManifest.xml index 32a2f2fa..04c2e995 100644 --- a/VideoOverlaySample/app/src/main/AndroidManifest.xml +++ b/VideoOverlaySample/app/src/main/AndroidManifest.xml @@ -1,13 +1,13 @@ - + framePairs = new ArrayList(); mTango.connectListener(framePairs, new OnTangoUpdateListener() { @@ -98,9 +83,9 @@ public void onPoseAvailable(TangoPoseData pose) { @Override public void onFrameAvailable(int cameraId) { - - // Check if the frame available is for the camera we want and - // update its frame on the camera preview. + + // Check if the frame available is for the camera we want and + // update its frame on the camera preview. if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) { tangoCameraPreview.onFrameAvailable(); } @@ -131,8 +116,15 @@ protected void onPause() { @Override protected void onResume() { super.onResume(); - if (!mIsConnected && mIsPermissionGranted) { - startCameraPreview(); + try { + if (!mIsConnected) { + startCameraPreview(); + } + } catch (TangoOutOfDateException e) { + Toast.makeText(getApplicationContext(), R.string.TangoOutOfDateException, + Toast.LENGTH_SHORT).show(); + } catch (TangoErrorException e) { + Toast.makeText(getApplicationContext(), R.string.TangoError, Toast.LENGTH_SHORT).show(); } } } diff --git a/VideoOverlaySample/app/src/main/res/values/strings.xml b/VideoOverlaySample/app/src/main/res/values/strings.xml index b07f29a0..db77ac82 100644 --- a/VideoOverlaySample/app/src/main/res/values/strings.xml +++ b/VideoOverlaySample/app/src/main/res/values/strings.xml @@ -4,5 +4,9 @@ VideoOverlaySample Hello world! Settings + "Tango exception! Try again!" + "Tango service outdated!" + "Reset motion tracking" + "Motion Tracking permission needed!"