ARGraphLibrary

Introduction: A simple library to add a graph in Real world
More: Author   ReportBugs   
Tags:

Yeah , Check us on Medium also :- https://medium.com/@deepakypro/how-to-plot-a-graph-in-real-world-using-arcore-android-4f5f1007fb86

A simple library that allows you to add a graph in Real world using ARCore.

20190205_092505

Gradle

Add following dependency to your root project build.gradle file:

allprojects {
    repositories {
        ...
        jcenter()
        maven { url "https://jitpack.io" }
        ...
    }
}

Add following dependency to your app module build.gradle file:

dependencies {
    ...
   implementation 'com.github.the-losers:ARGraphLibrary:x.y.z'
    ...
}

Configure

  • Manifest File

    • Permissions, you need two permissions , 1. Camera so you can add a graph in real world,
                                          **2. Storage** to record and save the added graph video. 
      
 ```groovy
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 ```

* Enable ARCore in **Android studio**, There are two types of AR apps: **AR Required** and **AR Optional**.

    * AR Required apps

    ```groovy
       <application>
       …
       <!-- Indicates that app requires ARCore ("AR Required"). Causes Google
       Play Store to download and install ARCore when the app is installed.
       -->

       <meta-data android:name="com.google.ar.core" android:value="required" />
       </application>  
    ```
    * AR Optional apps

    ```groovy
      <application>
      …
      <!-- Indicates that app supports, but does not require ARCore ("AR Optional").
      Unlike "AR Required" apps, Google Play Store will not automatically
      download and install ARCore when the app is installed.
      -->

     <meta-data android:name="com.google.ar.core" android:value="optional" />
     </application>
     ```
    Read more about it here - [Enable ARCore](https://developers.google.com/ar/develop/java/enable-arcore)
  • build.gradle

    • This library is using java 8 language features , so to enable them you will have to add below lines otherwise it will throw an error during compile time.

      compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
      }
      
  • AndroidX

    • ARGraph is using androidx library, So You will have to migrate your project to AndroidX. Read more about it here - Migrating to AndroidX

Usage

  • Create the GraphConfig builder,

       GraphConfig mGraphConfig = GraphConfig.newBuilder()
          .setGraphList(getList()) //pass the list that you want to add in real world
          .setEnableClassicPlatform(false) 
          .setEnableLogging(true) 
          .setEnableVideo(true)
          .setVideoQuality(VIDEO_QUALITY.QUALITY_1080P) //QUALITY_HIGH, QUALITY_2160P,QUALITY_1080P,QUALITY_720P,QUALITY_480P
          .build();
    
  • Call the function loadGraph,

       PlotGraph.get(context).loadGraph(mGraphConfig);
    
    • You can also check wheather a device support the arcore or not by simple calling the below method,

      if(Utils.checkIsSupportedDeviceOrFinish(this)){
      //Do stuffs
      } else{
      //hide button or whatever you wants to do
      }
      

App using ARGraph

My Run Tracker - The Run Tracking App

Author

Deepak Kumar

License

ARGraphLibrary is available under the BSD license. See the LICENSE file.

The End : Happy Coding :D

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools