Skip to content

Latest commit

 

History

History

HMS AR Ionic Demo

Contents


1. Introduction

This demo application demonstrates the usage of HMS AR Kit Cordova plugin.


2. Installation Guide

2.1. Ionic

  1. Install Ionic CLI and other required tools if haven't done before.

    npm install -g @ionic/cli cordova-res native-run
  2. Open the demo project's root directory.

  3. Install project dependencies.

    npm install

2.1.1. With Cordova Runtime

  1. Enable the Cordova integration.

    ionic integrations enable cordova
  2. Add the Android platform to the project.

    ionic cordova platform add android
  3. Install HMS AR plugin to the project.

    ionic cordova plugin add @hmscore/cordova-plugin-hms-ar
  4. Install HMS AR Ionic Native wrappers

    npm install @ionic-native/core @hmscore/ionic-native-hms-ar
  5. Build Ionic app to generate resource files.

    ionic build
  6. Run the app.

    ionic cordova run android --device

2.1.2. With Capacitor Runtime

  1. Enable the Capacitor integration.

    ionic integrations enable capacitor
  2. Initialize Capacitor.

    npx cap init [appName] [appId]
  3. Install HMS AR plugin to the project.

    npm install @hmscore/cordova-plugin-hms-ar
  4. Install HMS AR Ionic Native wrappers.

    npm install @ionic-native/core @hmscore/ionic-native-hms-ar
  5. Build Ionic app to generate resource files.

    ionic build
  6. Add the Android platform to the project.

    npx cap add android
  7. Updates dependencies, and copy any web assets to your project.

    npx cap sync
  8. Open the build.gradle file in the <project_root>/android directory. Add Huawei's maven repositories.

    buildscript {
        repositories {
            /*
                <Other repositories>
            */
            maven { url 'https://developer.huawei.com/repo/' }
        }
        dependencies {
            /*
                <Other dependencies>
            */
            classpath 'com.huawei.agconnect:agcp:1.5.0.300'
        }
    }
    
    /*
        <Other build.gradle entries>
    */
    
    allprojects {
        repositories {
            /*
                <Other repositories>
            */
            maven { url 'https://developer.huawei.com/repo/' }
        }
    }
  9. Open the project in Android Studio and run it.

    npx cap open android

3. Configuration and Description


4. Questions or Issues

If you have questions about how to use HMS samples, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with huawei-mobile-services.
  • GitHub is the official repository for these plugins, You can open an issue or submit your ideas.
  • Huawei Developer Forum HMS Core Module is great for general questions, or seeking recommendations and opinions.
  • Huawei Developer Docs is place to official documentation for all HMS Core Kits, you can find detailed documentations in there.

If you run into a bug in our samples, please submit an issue to the GitHub repository.


5. Licencing and Terms

Huawei AR Kit Cordova Plugin is licensed under the Apache 2.0 license.