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.
- only version 10 of Cordova is currently supported
- 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
- project is running under android 12 (api level 32), install required dependenies
- Editing the application
-
open the project directory and go to the
/MainCordovaApplication/www
subdirectoryit will contain your application code, edit it freely
- Launching and testing the application
-
โ ๏ธ Android app works with miniapps builds for the iOS environment fromMainCordovaApplication/platforms/ios
. -
For linux and macOS: there is
updateCordovaProjectToDemo
subtask which runs during project build (fileapp/build.gradle
, 66 line), this subtask automatically builds final cordova app filewww.zip
(MainCordovaApplication/platforms/ios/www.zip
) and copies it intoapp/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
- if you have this error
accept license agreements by:
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
- 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) {});
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:
- presentationStyle - application display type, required, should be set to present_fullscreen
- 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
-
Open Chrome and enter into url field
chrome://inspect/#devices
Choose WebView in ai.doma.miniappdemo and click "inspect" -
Yay! Standard Chrome debugging tools are connected to your mini-application
-
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
-
Install Doma app from Google Play
-
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:
-
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. -
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.
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.