This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest ... package="com.yourapp.packagename"> | |
<!-- Always needed for AR. --> | |
<uses-permission android:name="android.permission.CAMERA" /> | |
<uses-feature android:name="android.hardware.camera.ar" | |
android:required="true" /> | |
<application> | |
<meta-data android:name="com.google.ar.core" | |
android:value="required" /> | |
<activity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ArFragment mARFragment; | |
private ModelRenderable mObjRenderable; | |
private Anchor mAnchor = null; | |
private TransformableNode mARObject = null; | |
private AnchorNode mAnchorNode = null; | |
mARFragment.setOnTapArPlaneListener( | |
(HitResult hitResult, Plane plane, MotionEvent motionEvent) -> { | |
if (mObjRenderable == null) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void setARFragment() { | |
mARFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.ux_fragment); | |
// When you build a Renderable, Sceneform loads its resources in the background while returning | |
// a CompletableFuture. Call thenAccept(), handle(), or check isDone() before calling get(). | |
ModelRenderable.builder() | |
.setSource(this, R.raw.yourObject) | |
.build() | |
.thenAccept(renderable -> mObjRenderable = renderable) | |
.exceptionally( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean checkIsSupportedDeviceOrFinish(final Activity activity) { | |
if (Build.VERSION.SDK_INT < VERSION_CODES.N) { | |
Log.e(TAG, "Sceneform requires Android N or later"); | |
Toast.makeText(activity, "Sceneform requires Android N or later", Toast.LENGTH_LONG).show(); | |
activity.finish(); | |
return false; | |
} | |
String openGlVersionString = | |
((ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE)) | |
.getDeviceConfigurationInfo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = new Intent(); | |
intent.setComponent(new ComponentName("com.YourActivityPackage.name", | |
"com.unity3d.player.UnityPlayerActivity")); | |
startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = new Intent(); | |
intent.setComponent(new ComponentName("com.package.name", "com.package.name.TargetActivityName")); | |
startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = getPackageManager().getLaunchIntentForPackage("com.package.name"); | |
startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class ToastScript : MonoBehaviour | |
{ | |
private AndroidJavaObject javaObj = null; | |
// Use this for initialization | |
void Start () { | |
setActivityInNativePlugin (); | |
logEvent ("Toast Using Plugin!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Logger { | |
public static final String LOG_TAG = Logger.class.getSimpleName(); | |
protected Activity mCurrentActivity; | |
public void setActivity(Activity activity) | |
{ | |
mCurrentActivity = activity; | |
} | |
// Displays a Toast message and log an event |