Start a new topic

Fail to connect to camera service in Example(Android Native API)

Fail to connect to camera service in Example(Android Native API)


Please have a look at the runtime permission handling on Android API 23+.

A simple implementation is part of latest SDK Sample application, further details at
http://developer.android.com/training/permissions/requesting.html

best regards

 

I downloaded the sdk and copied all files into new project.

and now app is working perfectly on Samsung s4 but not working in Moto X(API 23).

and my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.innovare.wikitude3dsample" >

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

<!-- Tell the system this app requires OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />

<!-- rear facing cam -->
<uses-feature
android:name="android.hardware.camera"
android:required="true" />

<!-- do not support small resolution screens -->
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">

<activity
android:name="com.innovare.wikitude3dsample.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name="com.innovare.wikitude3dsample.SampleCategoryListActivity" />

<activity
android:name="com.innovare.wikitude3dsample.recognition.client.SimpleClientTrackingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.recognition.client.ExtendedClientTrackingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.recognition.client.ClientTracking3DActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.recognition.cloud.ContinuousCloudTrackingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.recognition.cloud.OnClickCloudTrackingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.camera.CameraControlsActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.rendering.external.ExternalRenderingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.rendering.internal.InternalRenderingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.plugins.BarcodePluginActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.plugins.FaceDetectionPluginActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<activity
android:name="com.innovare.wikitude3dsample.recorder.TrackingMapRecorderActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="fullSensor"/>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.wikitude.nativesdksampleapp.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>

</application>

</manifest>


it is showing error as:

04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b: Exception on setting up Camera
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b: java.lang.RuntimeException: Fail to connect to camera service
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at android.hardware.Camera.<init>(Camera.java:511)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at android.hardware.Camera.open(Camera.java:353)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at com.wikitude.common.camera.internal.b.v(CameraPreviewBase.java)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at com.wikitude.common.camera.internal.b.s(CameraPreviewBase.java)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at com.wikitude.common.camera.internal.b.t(CameraPreviewBase.java)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at com.wikitude.common.camera.internal.a$2.run(CameraPreviewAR.java)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at android.os.Handler.handleCallback(Handler.java:746)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at android.os.Handler.dispatchMessage(Handler.java:95)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at android.os.Looper.loop(Looper.java:148)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at android.app.ActivityThread.main(ActivityThread.java:5443)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at java.lang.reflect.Method.invoke(Native Method)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
04-01 12:40:38.205 6444-6444/com.innovare.wikitude3dsample E/b:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Login or Signup to post a comment