Skip to content
AWARE Framework Library for iOS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
AWAREFramework Add AWAREAmbientNoiseFFTDelegate into AmbientNoise plugin Jun 13, 2019
.travis.yml Add a sample app for a time scheduled ESM. Apr 4, 2019
AWAREFramework.podspec Add AWAREAmbientNoiseFFTDelegate into AmbientNoise plugin Jun 13, 2019
LICENSE first commit Mar 22, 2018 Change the HTTP method to GET from POST on iOS ESM plugin. May 3, 2019
_Pods.xcodeproj Initial commit Mar 22, 2018


CI Status Version License Platform

AWARE is iOS and Android framework dedicated to instrument, infer, log and share mobile context information, for application developers, researchers and smartphone users. AWARE captures hardware-, software-, and human-based data (ESM). They transform data into information you can understand.

Supported Sensors

  • Accelerometer
  • Gyroscope
  • Magnetometer
  • Gravity
  • Rotation
  • Motion Activity
  • Pedometer
  • Location
  • Barometer
  • Battery
  • Network
  • Call
  • Bluetooth
  • Processor
  • Proximity
  • Timezone
  • Wifi
  • Screen Events
  • Microphone (Ambient Noise)
  • Heartrate (BLE)
  • Calendar
  • Contact
  • Fitbit
  • Google Login
  • Memory
  • NTPTime
  • OpenWeatherMap

Example Apps

How To Use

To run the example project, clone the repo, and run pod install from the Example directory first.

Example 1: Initialize sensors and save sensor data to the local database

Just the following code, your application can collect sensor data in the background. The data is saved in a local-storage.

/// Example1  (Swift): Accelerometer ///
let accelerometer = Accelerometer()
accelerometer.setSensorEventHandler { (sensor, data) in

Example 2: Sync local-database and AWARE Server

AWARECore, AWAREStudy, and AWARESensorManager are singleton instances for managing sensing/synchronization schedule in the library. You can access the instances via AWAREDelegate. The AWAREDelegate is described in the Installation section.

let core    = AWARECore.shared()
let study   = AWAREStudy.shared()
let manager = AWARESensorManager.shared()

AWAREFramework-iOS allows us to synchronize your application and AWARE server by adding a server URL to AWAREStudy. About AWARE server, please check our website.

/// Example2 (Swift): Accelerometer + AWARE Server ///
let accelerometer = Accelerometer(awareStudy: study)
// or

Example 3: Apply settings on AWARE Dashboard

Moreover, this library allows us to apply the settings on AWARE Dashboard by using -joinStuyWithURL:completion method.

/// Example3 (Swift): AWARE Dashboard ////
let url = ""
study.join(withURL: url, completion: { (settings, studyState, error) in
    manager.addSensors(with: study)


AWAREFramework is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AWAREFramework', '~> 1.4'

First, add permissions on Xcode for the background sensing (NOTE: the following permissions are minimum requirements)

  • Info.plist

    • Privacy - Location Always and When In Use Usage Description
    • Privacy - Location Always Usage Description Image
  • Capabilities/Background Modes

    • Location updates Image

Second, (1) import AWAREFramework into your class and (2) request permission for accessing the iOS location sensor always. After the permission is approved, you can (3) activate AWARECore and (4) use any sensors by the way which is described in How To Use session.

/// AppDelegate.swift ///
import UIKit
import AWAREFramework /// (1) import `AWAREFramework` into your source code.

class AppDelegate: UIResponder, UIApplicationDelegate{

    override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let core = AWARECore.shared()
        /// (2) request permission
            /// (3) activate AWARECore
            /// (4) use sensors 
            /// EDIT HERE ///
        return true

Experience Sampling Method (ESM)

This library supports ESM. The method allows us to make questions in your app at certain times. The following code shows to a radio type question at 9:00, 12:00, 18:00, and 21:00 every day as an example. Please access our website for learning more information about the ESM.

/// Swift ///
let schdule = ESMSchedule()
schdule.notificationTitle   = "notification title"
schdule.notificationBody    = "notification body"
schdule.scheduleId          = "schedule_id"
schdule.expirationThreshold = 60
schdule.startDate           = Date.init()
schdule.endDate             = Date.init(timeIntervalSinceNow: 60*60*24*10)
schdule.fireHours           = [9,12,18,21]

let radio = ESMItem(asRadioESMWithTrigger: "1_radio", radioItems: ["A","B","C","D","E"])
radio.setTitle("ESM title")
radio.setInstructions("some instructions")

let esmManager = ESMScheduleManager.shared()
// esmManager.removeAllNotifications()
// esmManager.removeAllESMHitoryFromDB()
// esmManager.removeAllSchedulesFromDB()

Please call the following chunk of code for appearing ESMScrollViewController (e.g., at -viewDidAppear: ).

/// Swift ///
let schedules = ESMScheduleManager.shared().getValidSchedules() {
if(schedules.count > 0){
    let esmViewController = ESMScrollViewController()
    self.present(esmViewController, animated: true){}

Supported ESM Types

This library supports 16 typs of ESMs. You can see the screenshots from the link

  • Text
  • Radio
  • Checkbox
  • Likert Scale
  • Quick Answer
  • Scale
  • DateTime
  • PAM
  • Numeric
  • Web
  • Date
  • Time
  • Clock
  • Picture
  • Audio
  • Video


Yuuki Nishiyama


AWAREFramework is available under the Apache2 license. See the LICENSE file for more info.

You can’t perform that action at this time.