Connfa!
Open Source iOS & Android App for Conferences and Events

    How to build Android app v2

    Let’s identify primary steps to setup the app for your needs.

    Step 1

    You need to have a backend, which will provide Android application with all required content.

    Simply use Connfa Integration Server, or, if you already have your own backend, check Connfa API documentation described here.

    Step 2

    You need to perform initial project configuration to get it compilable.

    By default, Android Studio displays your project files in the Android view. Please change it on Project view.

    All project properties are in the same team-props directory.

    team-props

    They are Application id, Keystore, Base Url, Fabric Api Key, Twitter Api Key, Twitter Secret Key and Google Maps Api Key.

    First of all you should rename files: application.properties.sample, releaseSigningConfig.properties.sample, secrets.properties.sample to just application.properties, releaseSigningConfig.properties, secrets.properties.

    team-props-open

    Step 3

    Add Application id in application.properties file.

    application-properties

    applicationId= com.connfa

    Step 4

    All API Keys and base URL are located in secrets.properties and you need to configure them.

    Pay attention! All keys are supposed to be added without quotes!

    application-properties

    You need to change a base URL that is used for communication with backend.

    baseUrl= your base url

    For enabling crash reporting service and mobile analytics tools you should add fabric Api Key in secrets.properties.

    fabricApiKey = your fabric Api Key

    For enabling Google Maps Api you should add Api Key in secrets.properties.

    googleMapsApiKey = your Api Key

    To enable Twitter API you should add Twitter Secret Key and Twitter API Key in secrets.properties.

      
    twitterApiKey= your Twitter Api Key
    twitterSecret= your Twitter Secret Key
      
    

    Step 5

    Generate a keystore and use it to sign your apk.

    application-properties

    All signing configurations are located in releaseSigningConfig.properties.

    application-properties

    storeFile is a location where your keystore should be created

    storePassword is a secure password for your keystore

    keyAlias is a name for your key

    keyPassword is a secure password for your key, it should differ from the password you chose for your keystore

      
    keyAlias = 123456
    keyPassword = 123456
    storeFile = keystore.keystore
    storePassword = 123456
      
    

    Step 6

    Use this link and follow the onscreen instructions to generate the google-services.json for your app.

    google-services

    Step 7

    Application also has Google Analytics. To track the statistics please add respective XML config file for analytics. Sign in to your Google Analytics account, create a folder named xml inside res.

    tracker

    Create an xml file named global_tracker.xml inside xml folder and add below analytics configurations.

    <!-- End current session if app sleeps for a period of time -->
    <integer name="ga_sessionTimeout">300</integer>
     
    <!-- Enable automatic Activity measurement -->
    <bool name="ga_autoActivityTracking">true</bool>
     
    <!--  The property id associated with this analytics tracker -->
    <string name="ga_trackingId">XX-XXXXXX-X</string>
     
    <string name="ga_sampleFrequency">100.0</string>
     
    <bool name="ga_reportUncaughtExceptions">true</bool> 
    

    Step 8

    All dependencies were moved to dependencies.gradle file.

    tracker

    You need to modify this file if you want to add new dependencies.

      
    ext {
       libraries = [
               app: [
                       annotations     : 'org.jetbrains:annotations:13.0',
                       appCompat       : 'com.android.support:appcompat-v7:25.0.0',
                       crashlytics     : 'com.crashlytics.sdk.android:crashlytics:2.6.5',
                       gson            : 'com.google.code.gson:gson:2.8.0',
                       materialTabStrip: 'com.jpardogo.materialtabstrip:library:1.0.8',
                       parallaxScroll  : 'com.github.nirhart:parallaxscroll:1.0',
                       playAnalytics   : 'com.google.android.gms:play-services-analytics:9.8.0',
                       playMaps        : 'com.google.android.gms:play-services-maps:9.8.0',
                       shadowLayout    : 'com.github.dmytrodanylyk.shadow-layout:library:1.0.2',
                       twitter         : 'com.twitter.sdk.android:twitter:2.1.1',
                       timber          : 'com.jakewharton.timber:timber:4.3.1',
                       volley          : 'com.mcxiaoke.volley:library:1.0.19'
               ]
       ]
    }
      
    

    Then all dependencies must be added within build.gradle.

    tracker

      
    dependencies {
       compile libraries.app.annotations
       compile libraries.app.gson
       compile libraries.app.volley
    
       compile libraries.app.shadowLayout
       compile libraries.app.materialTabStrip
       compile libraries.app.parallaxScroll
       compile libraries.app.scaleImageView
       compile libraries.app.timber
    
       compile libraries.app.appCompat
       compile libraries.app.playAnalytics
       compile libraries.app.playMaps
    
       compile(libraries.app.crashlytics) {
           transitive = true
       }
       compile project(':drupalSDK')
       compile libraries.app.twitter
    }
      
    

    Step 9

    To update application UI theme, all you need is to replace resource files. There are fonts folder inside assets directory and you can add new font there.

    tracker

    But all references to this font were extracted into resource file named fonts.xml. This xml file is inside values directory, also there are other resource files: color, string etc.

    tracker

    Step 10 (Optional)

    Travis is a continuous integration service that gives the ability to run tests against your latest Android builds. You can setup your projects to run both unit and integration tests, which can also include launching an emulator option.

    All travis configuration are located in ci-mock-google-services-setup.sh

    tracker

    There you need to specify api_key, tracking_id and package_name.

      
    echo '{
     "project_info": {
       "project_number": "0",
       "project_id": "mock-project-id"
     },
     "client": [
       {
         "client_info": {
           "mobilesdk_app_id": "0",
           "android_client_info": {
             "package_name": "com.connfa.droidcon"
           }
         },
         "api_key": [
           {
             "current_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
           }
         ],
         "services": {
           "analytics_service": {
             "status": 2,
             "analytics_property": {
               "tracking_id": "UA-123456-78"
             }
           }
         }
       }
     ],
     "configuration_version": "1"}'
    }
      
    

    But be careful, if you run it on your dev machine it will override your valid google-services.json file!