Giter VIP home page Giter VIP logo

mobile_cordova_android_miniapp's Introduction

Hello

This is a Condo Miniapps playground for Android, it is still under development, but already allows you to feel the real process of interaction with the application.

You can find the cordova app itself in the MainCordovaApplication folder, where in the www folder there is an example of interaction with the native api and you can develop something of your own.

Important! Known issues.

  1. only version 10 of Cordova is currently supported

Content

  1. Getting started

  2. Common methods.

  3. Important differences.

  4. Testing.

    4.1 Testing in Demo environment

    4.2 Testing in Production environment

  5. Publishing.

Getting started

  1. Installing the necessary dependencies:
  • make sure you have the latest version of Android Studio installed

  • install nvm, node and npm

  • cordova installation:

      npm install -g cordova
    
  • open Android Studio, choose project folder to open, then open sdk manager

SDK manager

  • project is running under android 12 (api level 32), install required dependenies

SDK manager SDK manager SDK manager

  1. Editing the application
  • open the project directory and go to the /MainCordovaApplication/www subdirectory

    it will contain your application code, edit it freely

  1. Launching and testing the application
  • โš ๏ธAndroid app works with miniapps builds for the iOS environment from MainCordovaApplication/platforms/ios.

  • For linux and macOS: there is updateCordovaProjectToDemo subtask which runs during project build (file app/build.gradle, 66 line), this subtask automatically builds final cordova app file www.zip (MainCordovaApplication/platforms/ios/www.zip) and copies it into app/src/main/res/raw/www.zip to use it by android app.

  • For Windows: before each app build run these scripts:

      cd MainCordovaApplication
      cordova prepare ios
      tar -a -c -f www.zip www
      copy /y  www.zip ..\..\..\app\src\main\res\raw\www.zip
    
  • open project folder with Android Studio, wait until indexing is complete, then choose real or virtual device and click play button

Run app

  • if you have this error

Run app

accept license agreements by:

    cd ~/Library/Android/sdk/tools/bin/
    ./sdkmanager --licenses

Common methods

  • authorization

function requestServerAuthorizationByUrl(miniapp_server_init_auth_url, custom_params_reserver_for_future_use, success, error)

example:

        cordova.plugins.condo.requestServerAuthorizationByUrl('https://miniapp.d.doma.ai/oidc/auth', {}, function(response) {
            console.log('recive authorication result => ', JSON.stringify(response));
            window.location.reload();
        }, function(error) {
            console.log(error);
        });
  • obtaining a current resident/address

function getCurrentResident(success, error)

example:

        cordova.plugins.condo.getCurrentResident(function(response) {
            console.log("current resident\address => ", JSON.stringify(response));
        }, function(error) {
            console.log(error);
        });
  • application closing

function closeApplication(success, error)

example:

        cordova.plugins.condo.closeApplication(function(response) {}, function(error) {});

Important differences.

Unlike the standard Cordova, our application uses an additional configuration file, which must be located in the www directory and named native_config.json

This file is a json file and may contain the following fields:

  1. presentationStyle - application display type, required, should be set to present_fullscreen
  2. mobile_permissions - An array of strings describing the necessary permissions for the application to work. the array can contain the following values: record_audio, camera, audio_settings

Testing

Demo environment

  1. Open Chrome and enter into url field chrome://inspect/#devices Choose WebView in ai.doma.miniappdemo and click "inspect"

    inspect

  2. Yay! Standard Chrome debugging tools are connected to your mini-application

    console

Production environment

  1. Take www.zip archive built for ios environment:

     MainCordovaApplication/platforms/ios/www.zip
    

    If it doesn't exist create it from folder:

     /MainCordovaApplication/platforms/ios/www
    
  2. Install Doma app from Google Play

  3. The app you downloaded has built-in functionality for debugging mini-applications. To turn it on & off, you can use these deeplinks from your phone:

  1. Now, on the main application screen in the list of mini-applications, the last button allows you to download or replace a previously downloaded mini-application from files. When you click on it, you need to select the previously taken www.zip archive.

  2. The application loaded in this way has a built-in js console, which is accessible by clicking on the button at the bottom right of the open mini-application and is able to show a lot of additional information, including various errors.

Publishing

To publish the mini-application, send the www.zip archive you received during the testing phase to the people at Doma with whom you interact.

mobile_cordova_android_miniapp's People

Contributors

a14x4y avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.