README.md

Generic Digital Signage Player (mobile Application)

Description

The Generic Digital Signage mobile application is a hybrid app that interprets data provided by the any Digital Signage content management system via REST API endpoints. The framwork which is used is based on nodejs and uses MongoDB as a database.

Technology stack

The web application is based on the framework Meteor. Meteor is a full-stack JavaScript platform for developing modern web and mobile applications. Meteor includes a key set of technologies for building connected-client reactive applications, a build tool, and a curated set of packages from the Node.js and general JavaScript community.

For getting a quick introduction visit the Meteor Docs

In order to have a hybrid mobile app, the meteor app is compiled with Cordova that provides multiple platforms like Android, iOS etc.

Prerequisites

  1. Download Meteor here https://docs.meteor.com/install.html

  2. Install Meteor

  3. Install MongoDB locally and create a database, e.g. generic-signage. Idealy you run an instance with docker. The version does not play a big role.

  4. To run on Android device, follow steps to have required libraries installed: https://guide.meteor.com/cordova.html#installing-prerequisites-android and enable developer mode on device, as well allow usb debugging in developer settings

Usage

  1. Open console, clone repo and change to meteor route directory: /app

  2. Create a settings.json, see example below:

Notes

  • Email sender name needs to be exactly like the Name in Email Provider page, otherwise Emails will be detected as Spam
  • storagePath and downloadRouteh are just needed if you use the Ruhrkraft Content Management System in order to provide playlist clips
  • logging defines if logs should be stored locally in order to view them via any CMS. Logs will be sent to api info.
  • apiUrl jsut necessary if you have a Rest API for logs, content-tracking and status tracking
  • jetson is just necessary if you use the Ruhrkraft IoT Device in order to track detection via a camera
  • webappToken just necessary if IoT devices are used, and a abckend for data analysis that needs the mastar data to build reports
  • startCron defines if cron job should run (necessary to run on just one server in case app is scaled and runs on multiple servers)
  • ruhrkraftInbound configures the inbound player endpoint /connector/ruhrkraft/*, which only writes incoming requests to <logDir>/inbound.log (rotated daily by the cron instance, kept 14 days). Without token every request is accepted; with it, requests need X-Show-X-Token: <token>, Authorization: Bearer <token> or ?token=<token>. logDir defaults to /var/log/ruhrkraft and must be writable by the app user
{
    "storagePath": "PATH_TO_ANY_LOCAL_DIR",
    "downloadRoute": "ANY_DOWNLOAD_ROUTE",
    "sender": {
      "name": "Ruhrkraft doNotReply",
      "email": "[email protected]"
    },
    jetson: {
      apiUrl: process.env.PROD_RUHRKRAFT_API_URL,
      apiKey: process.env.PROD_RUHRKRAFT_JETSON_API_KEY
    },
    "public": {
      "apiUrl": "https://rapi-dev.ruhrkraft.io/",
      "apiKey": "API_KEY",
      "logging": enabled/disabled,

      //debug options for device logging
      "deviceLogs": {
        "debugMode": true
      },

      //debug options for content tracker
      "contentTracker": {
        "debugMode": false
      }
    },
    "webappToken": "WEBAPP_TOKEN" // Token to provide device status and get config webapp,
    "startCron": 0, // 1 if cron should be started on server, 0 if not
    "useApiForSubscription": 1, // if 1 external source (API) is used to get client subscription, 0 if subscription is on client object in DB
    "useExternalCMS": 0, // 1 if RK CMS is not used, very important for device states as cron job for offline checks periodically. IN RK world the CMS does that
    "alertEmail: "[email protected]" // alert eimal mailbox, e.g. player offline event, player registered
    "playerMonitoring": { // optional, players ping https://<baseUrl>/ping/<pingKey>/<device-name>-<serial-suffix>?create=1 every 5 min via the server
      "baseUrl": "https://playerstatus.displaypoint.org",
      "pingKey": "PING_KEY" // keep out of "public", it must not reach the players
    },
    "ruhrkraftInbound": { // optional, inbound player endpoint
      "token": "SHARED_SECRET", // optional, omit to accept all requests
      "logDir": "/var/log/ruhrkraft" // optional
    }
  1. Duplicate mobile-config-example.js and rename file to mobile-config.js

Run in browser

  1. Run command export METEOR_PACKAGE_DIRS="pathToMeteorPackageDirectoy"

  2. Run command meteor npm install to install npm dependencies (Packages) and run the app

  3. Run command meteor --settings pathToSettingsFile

Run on Android device

  1. Run command export METEOR_PACKAGE_DIRS="/Users/b.dorner/Desktop/meteor-packages"

  2. Run command (Linux or MacOS) source ~/.bash_profile

  3. Run command (Linux or MacOS) meteor npm install

  4. Run command (Linux or MacOS) NO_HMR=1 MONGO_URL=URL_TO_MONGO meteor run android-device -p PORT_TO_CHOOSE --settings pathToSettingsFile --mobile-server IP_OF_COMPUTER:PORT_TO_CHOOSE

Build APK

  1. Make sure all requirements of Cordova are installed and the configuration (e.g. Environment Variables) is done. Here you find a guide for Android

  2. Duplicate ./build-exampls.sh file, enter paths for the following variables and rename the file to build.sh (as the file is defined in .gitignore):

PROJECT_DIRECTORY="pathToProjectDirectoy" METEOR_BUILD_DIRECTORY="pathToMeteorBuildDirectoy" METEOR_PACKAGE_DIRS="pathToMeteorPackageDirectoy"

If you want to add a new app (instance), you need to add a build block including all needed info. Also, in the instances folder a mobile config has to be created. If the new app has a customized design (css files, icon and splashscreen), a new folder needs to be created that includes all needed files (check in existing instances).

Important: the following ids need to be equal if you create a new instance (app) in the mobile-config.js file:

  • id: 'io.ruhrkraft.scromogeneric',
  • name: 'scromogeneric',

In additiion, the name of the app in the package.json file has to have the same name, e.g. scromogeneric

Note

Do not commit or get confused by the git changes while building.

  1. Run the updated build.sh script:

sh build.sh

Remote debugging with Chrome Browser

  1. Plug the device via usb to computer

  2. Change to platform tools directory cd /Users/$username/Library/Android/sdk/platform-tools

  3. Show devices ./adb devices

  4. Set Network Port ./adb tcpip 5555

  5. Connect via IP ./adb connect 192.168.x.x

  6. Check remote devices in Google Chrome Console with url: chrome://inspect/#devices and open window by clicking inspect for the device to be debugged

Sign Cordova Application

  1. Sign project with Android Studio

Dependencies

The meteor package dependencies are listed in the file /app/.meteor/packages

NPM dependencies are listed in the file package.json

Getting help

If you have questions, concerns, bug reports, etc, please send us an email request to [email protected]. The Email will be filtered in our ticket system and replied as soon as possible.

Credits

Developing by Ruhrkraft (https://ruhrkraft.io)

Contributors: Benjamin Dorner, Sebastian Schwiers