Setting up Remodel-AR in Android
Creating and configuring an Android project that uses Remodel-AR.
Step 1
Create a new project, Select the Empty Activity template.

Step 2
Name the project Paintly

Step 3
Once the project is loaded, We will add the Remodel-AR library to our project by adding the aar file to app/libs folder like this:

Now Let's proceed to add it as dependency to the app module
Step 4:
First copy path of the AAR file like this:


Step 5:
Open Project Structure dialog

Step 6:
Add dependency of the AAR file

Simply paste the path you copied earlier under Step 1 like this

Now hit the Gradle icon to sync this changes

Step 7:
Once the syncing is done, replace all the content of MainActivity.kt with following:
package com.example.paintly
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.LayoutInflater
import com.passiolife.paintAR.PaintARActivity
class MainActivity : PaintARActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val inflater: LayoutInflater =
applicationContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
mUnityPlayer.addView(inflater.inflate(R.layout.activity_main, null));
}
}
Step 8: Now open the AndroidManifest.xml file, find the <activity> Node and replace it with below:
<activity
android:name=".MainActivity"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density"
android:exported="true"
android:hardwareAccelerated="false"
android:process=":PaintAR"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Step 9:
Create a file named ids.xml under res/values folder and add below content in it:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="unitySurfaceView" />
</resources>
Step 10:
Add below line to strings.xml file
<string name="game_view_content_description">Game view</string>
Step 11:
Before you can use any feature of the SDK, it is required that you successfully get callback from the configure() method, Just call it anytime before you need to start using features of the SDK. Here is code that you can copy and put in your onCreate().
configure("Passio Developer key","uniqueDeviceIdentifier","appVersion, object : PassioSDKStatus {
/**
* When SDK authentication is successful for the first time, SDK will use this callback to notify the app.
*/
override fun onPassioSDKLicensed() { Log.d(TAG, "onPassioSDKLicensed")}
/**
* When SDK authentication is successful for the first time,
* after a new session starts, on authentication success, SDK will use the onPassioSDKValid callback instead of the onPassioSDKLicensed.
*/
override fun onPassioSDKValid() { Log.d(TAG, "onPassioSDKValid")}
/**
* When the camera renders the first frame, it gives a callback to an app that the camera is ready.
*/
override fun onCameraReady() { Log.d(TAG, "onCameraReady")}
/**
* When SDK authentication is failed, SDK will use this callback to notify the app.
*/
override fun onPassioSDKError(error: String) { Log.d(TAG,"onPassioSDKError" + error) }
}
If you run this, It will show a camera view in your screen, Now you are ready to use Remodel-AR SDK.
If at any point you need help from the Passio team, please reach out to us at support@passiolife.com
Last updated