Skip to main content
Glama

dhis2_android_init_project

Initialize an Android project with DHIS2 SDK integration by specifying project name, application ID, language, and features like offline sync, GPS capture, or biometric authentication.

Instructions

Initialize a new Android project with DHIS2 SDK integration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
applicationIdYesAndroid application ID (e.g., "org.dhis2.healthtracker")
architectureNoAndroid architecture pattern to implement
dhis2SdkVersionNoDHIS2 Android SDK version (e.g., "1.10.0")
featuresNoFeatures to include in the project setup
languageYesProgramming language for Android app
minSdkVersionNoMinimum Android SDK version (default: 21)
projectNameYesAndroid project name (e.g., "dhis2-health-tracker")
targetSdkVersionNoTarget Android SDK version (default: 34)

Implementation Reference

  • The core handler function that takes AndroidProjectConfig input and generates a comprehensive markdown guide for initializing a DHIS2 Android project, including project structure, permissions, architecture patterns, and next steps.
    export function generateAndroidProjectInit(config: AndroidProjectConfig): string { const { projectName, applicationId, minSdkVersion = 21, targetSdkVersion = 34, language, dhis2SdkVersion, features = [], architecture } = config; return `# DHIS2 Android Project Initialization Guide ## πŸš€ Quick Start Commands \`\`\`bash # Create new Android project structure mkdir ${projectName} cd ${projectName} # Initialize Android project with Android Studio template or CLI # Option 1: Android Studio # - Create new project with API ${minSdkVersion}+ and ${language} # - Choose Empty Activity template # - Set Application name: ${projectName} # - Set Package name: ${applicationId} # Option 2: Command line with Android CLI tools android create project \\ --name ${projectName} \\ --target android-${targetSdkVersion} \\ --path ./${projectName} \\ --package ${applicationId} \\ --activity MainActivity # Initialize git repository git init \`\`\` ## πŸ“± Project Structure \`\`\` ${projectName}/ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ main/ β”‚ β”‚ β”‚ β”œβ”€β”€ java/${applicationId?.replace(/\./g, '/') || 'com/example/app'}/ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ MainActivity.${language === 'kotlin' ? 'kt' : 'java'} β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ data/ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ local/ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ remote/ β”‚ β”‚ β”‚ β”‚ β”‚ └── repository/ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ domain/ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ model/ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ repository/ β”‚ β”‚ β”‚ β”‚ β”‚ └── usecase/ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ presentation/ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ ui/ β”‚ β”‚ β”‚ β”‚ β”‚ └── viewmodel/ β”‚ β”‚ β”‚ β”‚ └── utils/ β”‚ β”‚ β”‚ β”œβ”€β”€ res/ β”‚ β”‚ β”‚ └── AndroidManifest.xml β”‚ β”‚ β”œβ”€β”€ androidTest/ β”‚ β”‚ └── test/ β”‚ β”œβ”€β”€ build.gradle${language === 'kotlin' ? '.kts' : ''} β”‚ └── proguard-rules.pro β”œβ”€β”€ gradle/ β”œβ”€β”€ build.gradle${language === 'kotlin' ? '.kts' : ''} β”œβ”€β”€ gradle.properties └── settings.gradle${language === 'kotlin' ? '.kts' : ''} \`\`\` ## πŸ—οΈ Architecture Pattern: ${architecture?.toUpperCase().replace('_', ' ') || 'MVVM'} ${generateArchitecturePattern(architecture || 'mvvm', language || 'kotlin')} ## πŸ“‹ Required Permissions Add these permissions to \`app/src/main/AndroidManifest.xml\`: \`\`\`xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="${applicationId}"> <!-- DHIS2 SDK Required Permissions --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> ${(features || []).includes('gps_capture') ? ` <!-- Location Services --> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />` : ''} ${(features || []).includes('camera_integration') ? ` <!-- Camera & Media --> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />` : ''} ${(features || []).includes('encrypted_storage') ? ` <!-- Storage & Security --> <uses-permission android:name="android.permission.USE_FINGERPRINT" /> <uses-permission android:name="android.permission.USE_BIOMETRIC" />` : ''} ${(features || []).includes('offline_sync') ? ` <!-- Background Sync --> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />` : ''} <application android:name=".${(projectName || 'App').replace(/-/g, '')}Application" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.${(projectName || 'App').replace(/-/g, '')}" android:networkSecurityConfig="@xml/network_security_config"> <activity android:name=".MainActivity" android:exported="true" android:theme="@style/Theme.${(projectName || 'App').replace(/-/g, '')}.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> ${(features || []).includes('offline_sync') ? ` <!-- Background Sync Service --> <service android:name=".service.SyncService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" />` : ''} </application> </manifest> \`\`\` ## πŸ”§ Next Steps 1. **Configure Gradle**: Use \`dhis2_android_configure_gradle\` tool 2. **Set up Authentication**: Use \`dhis2_android_setup_authentication\` tool 3. **Configure Data Sync**: Use \`dhis2_android_setup_sync\` tool 4. **Add UI Components**: Use \`dhis2_android_configure_ui_patterns\` tool ## πŸ“š Additional Resources - [DHIS2 Android SDK Documentation](https://docs.dhis2.org/en/develop/developing-with-the-android-sdk/about-this-guide.html) - [Android Architecture Guide](https://developer.android.com/guide/components/activities/activity-lifecycle) - [Material Design Components](https://material.io/develop/android) ## πŸ§ͺ Development Commands \`\`\`bash # Build debug APK ./gradlew assembleDebug # Run tests ./gradlew test # Install on connected device ./gradlew installDebug # Generate signed APK ./gradlew assembleRelease \`\`\` `; }
  • src/index.ts:1237-1247 (registration)
    Registers the MCP tool 'dhis2_android_init_project' in the main server request handler switch statement, extracting arguments and calling the generateAndroidProjectInit handler.
    case 'dhis2_android_init_project': const androidProjectArgs = args as any; const androidProjectInstructions = generateAndroidProjectInit(androidProjectArgs); return { content: [ { type: 'text', text: androidProjectInstructions, }, ], };
  • TypeScript interface defining the input parameters/schema for the Android project initialization tool.
    export interface AndroidProjectConfig { projectName: string; applicationId: string; minSdkVersion: number; targetSdkVersion: number; language: 'kotlin' | 'java'; dhis2SdkVersion: string; features: string[]; architecture: string; }
  • Maps the tool to the 'canUseMobileFeatures' permission in the TOOL_PERMISSIONS static map.
    ['dhis2_android_init_project', 'canUseMobileFeatures'],

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dradebo/dhis2-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server