This is the bare minimum setup required to run Plattar on Android devices.

Use this example to start a new project or integrate the Plattar SDK into existing projects.

Minimum Setup Example
This is the bare minimum setup required to run Plattar
public final class Main extends Activity {
  private PlattarEngine app;

  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    // warmup the AR systems
    app = com.plattar.android.PlattarMain.init(this);
    
    // setup the app code
    final String appCode = getString(R.string.app_code);
    final PlattarSettings settings = new PlattarSettings(appCode);
    
    // setup the app, this is an async process
    app.setup(settings);
    
    // start pre-emptively, this will run when setup is complete
    app.start();
  }
  
  @Override
  public void onResume() {
    super.onResume();

    // allow the activity to be GC'd
    com.plattar.android.PlattarMain.setActivity(this);
    app.resume();
  }
  
  @Override
  protected void onPause() {
  	super.onPause();
    app.pause();
  }
  
  @Override
  protected void onDestroy() {
    super.onDestroy();
    app.destroy();

    // allow the activity to be GC'd
    com.plattar.android.PlattarMain.setActivity(null);
  }
}

Internally, Plattar may ask for certain permissions such as camera access, sensor access or disk access.

These permissions can be piped to be handled internally by the SDK

Permission Access
@Override
public void onRequestPermissionsResult(int requestCode,
                                       String[] permissions,
                                       int[] grantResults) 
{
  // pipe permissions to be handled by Plattar directly
  PlattarPermission.onRequestPermissionsResult(requestCode, 
                                               permissions, 
                                               grantResults);
}

@Override
public void onActivityResult(int requestCode,
                             int resultCode,
                             Intent intent) 
{
  super.onActivityResult(requestCode, 
                           resultCode, 
                           intent);

  // pipe permissions to be handled by Plattar directly
  PlattarChromeClient.onActivityResult(requestCode, 
                                         resultCode, 
                                         intent);
}