I'm designing a Augmented Reality Android application using Sceneform. It should be able to take a photo shot with the virtual 3D objects and the physical environment but the application keeps on crashing.
I created a class WritingArFragment in java and referencing it in a fragment but it's not working. It says the Class 'WritingArFragment' is never used. When I change the android:name="fully.qualified.class.name.WritingArFragment" to android:name="com.google.ar.sceneform.ux.ArFragment" it works. But when I leave it as android:name="fully.qualified.class.name.WritingArFragment", it always crashes.
I want the application to take shot of the AR environment together with 3D objects without crashing.
//WritingArFragment.java public class WritingArFragment extends ArFragment { @Override public String[] getAdditionalPermissions() { String[] additionalPermissions = super.getAdditionalPermissions(); int permissionLength = additionalPermissions != null ? additionalPermissions.length : 0; String[] permissions = new String[permissionLength + 1]; permissions[0] = Manifest.permission.WRITE_EXTERNAL_STORAGE; if (permissionLength > 0) { System.arraycopy(additionalPermissions, 0, permissions, 1, additionalPermissions.length); } return permissions; } }
I'm designing a Augmented Reality Android application using Sceneform. It should be able to take a photo shot with the virtual 3D objects and the physical environment but the application keeps on crashing.
I created a class WritingArFragment in java and referencing it in a fragment but it's not working. It says the Class 'WritingArFragment' is never used. When I change the
android:name="fully.qualified.class.name.WritingArFragment"
toandroid:name="com.google.ar.sceneform.ux.ArFragment"
it works. But when I leave it asandroid:name="fully.qualified.class.name.WritingArFragment"
, it always crashes.I want the application to take shot of the AR environment together with 3D objects without crashing.
//WritingArFragment.java
public class WritingArFragment extends ArFragment { @Override public String[] getAdditionalPermissions() { String[] additionalPermissions = super.getAdditionalPermissions(); int permissionLength = additionalPermissions != null ? additionalPermissions.length : 0; String[] permissions = new String[permissionLength + 1]; permissions[0] = Manifest.permission.WRITE_EXTERNAL_STORAGE; if (permissionLength > 0) { System.arraycopy(additionalPermissions, 0, permissions, 1, additionalPermissions.length); } return permissions; } }
//content_main.xml
<fragment android:id="@+id/sceneform_fragment" android:name="fully.qualified.class.name.WritingArFragment" android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintBottom_toTopOf="@id/gallery_layout" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="spread" app:layout_constraintVertical_weight="9" />