DEV Community

Cover image for HowTo: Augmented Reality without ArCore -> kotlin + mobile sensors + Rx πŸ’₯ πŸš€
Mateusz for Netguru

Posted on

13 6

HowTo: Augmented Reality without ArCore -> kotlin + mobile sensors + Rx πŸ’₯ πŸš€

Augmented Reality

Do you ever wanted to play with AR a little but didn't want to dive deep into whole ARCore experience?
In our company as a part of R&D research we developed a little library that provides you with a view showing labels of the destinations provided by you. It's an open source project so you can contribute or write suggestions of new features at our repo https://github.com/netguru/ar-localizer-view-android

You can easily use it in your projects:

Using library

  1. Add repository in you projects build.gradle file

    repositories {
        maven {  url 'https://dl.bintray.com/netguru/maven/' }
        ...
    }
    
  2. Add library dependency

        dependencies {
                implementation 'com.netguru.arlocalizerview:arlocalizerview:0.1.0'
        }
    
  3. Add view to your layout

     <co.netguru.arlocalizer.arview.ARLocalizerView
            android:id="@+id/arLocalizer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
    
  4. In in arLocalizerView onCreate method you need to provide

    interface ARLocalizerDependencyProvider {
        fun getSensorsContext(): Context
        fun getARViewLifecycleOwner(): LifecycleOwner
        fun getPermissionActivity(): Activity
    }
    
    fun arLocalizerView.onCreate(arLocalizerDependencyProvider: ARLocalizerDependencyProvider)
    
  5. In order to process the permission request you need to provide permission results to the view.

        fun onRequestPermissionResult(
            requestCode: Int,
            permissions: Array<out String>,
            grantResults: IntArray
        )
    
  6. Finally in order to display the destination labels on the camera preview use

    arLocalizerView.setDestinations(destinations: List<LocationData>)
    

Library in action!

Library in action
Library in action
Library in action

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Sentry mobile image

App store rankings love fast apps - mobile vitals can help you get there

Slow startup times, UI hangs, and frozen frames frustrate usersβ€”but they’re also fixable. Mobile Vitals help you measure and understand these performance issues so you can optimize your app’s speed and responsiveness. Learn how to use them to reduce friction and improve user experience.

Read full post β†’

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay