1. Home
  2. SDK Android
  3. Implementation
  4. ArActivity

ArActivity

The com.bear.common.sdk.ui.activities.main.ArActivity class provides an augmented reality view so you can easily embed it in your application. Create an activity that extends ArActivity. Your activity must at least implement the following methods:

  • inflateContentView(): here you must inflate your desired layout and add it as an additional content view to the activity by calling addContentView method.
  • openWebView(String url): this method will be triggered when a webview asset will be clicked by user. Here you can define the behavior of your application for managing webview assets. You can either invoke the browser application with a URL intent or handle it as a webview displayed in a fragment for example.

In addition, you can specify the behavior of your augmented reality activity by overriding the following methods:

  • int getScanTimeout() which will return the timeout in seconds for the scan. The default implementation will return 0 which disables the timeout.
  • int getScanLineColor() which will return the color for the scan line as an integer value. Default value is white.

While augmented reality view initialization in progress, screen will be black. You can display a drawable instead just by overriding the ar_splashscreen.xml drawable resource.

When a marker is recognized, the augmented reality view will automatically display this marker and its assets. You can remove it from the view by calling the BearHandler.cleanView() method. See BearHandler section for more information on this class.

You can find basic and advanced example in our sample application.

Was this article helpful to you? Yes No

How can we help?