Latest 0.4.0
License Apache2
Platforms ios 10.0
Dependencies com.awareframework.ios.sensor.core

AWARE: Timezone

CI Status

The timezone sensor keeps track of the user’s current timezone.


iOS 10 or later


com.awareframework.ios.sensor.timezone is available through CocoaPods.

  1. To install it, simply add the following line to your Podfile:

    pod 'com.awareframework.ios.sensor.timezone'
  2. Import com.awareframework.ios.sensor.timezone library into your source code.
    import com_awareframework_ios_sensor_timezone 

Public functions


  • init(config:TimezoneSensor.Config?) : Initializes the timezone sensor with the optional configuration.
  • start(): Starts the timezone sensor with the optional configuration.
  • stop(): Stops the service.


Class to hold the configuration of the sensor.


  • sensorObserver: TimezoneObserver: Callback for live data updates.
  • enabled: Boolean Sensor is enabled or not. (default = false)
  • debug: Boolean enable/disable logging to Logcat. (default = false)
  • label: String Label for the data. (default = "")
  • deviceId: String Id of the device that will be associated with the events and the sensor. (default = "")
  • dbEncryptionKey Encryption key for the database. (default = null)
  • dbType: Engine Which db engine to use for saving data. (default = Engine.DatabaseType.NONE)
  • dbPath: String Path of the database. (default = "aware_timezone")
  • dbHost: String Host for syncing the database. (default = null)


  • TimezoneSensor.ACTION_AWARE_TIMEZONE broadcasted when there is new timezone information. Extra includes TimezoneSensor.EXTRA_DATA for the new timezone.

Data Representations

Timezone Data

Field Type Description
timezoneId String the timezone ID string, i.e., “America/Los_Angeles, GMT-08:00”
deviceId String AWARE device UUID
label String Customizable label. Useful for data calibration or traceability
timestamp Long unixtime milliseconds since 1970
timezone Int Timezone of the device
os String Operating system of the device (ex. android)

Example usage

let timezoneSensor = TimezoneSensor.init(TimezoneSensor.Config().apply{ config in
    config.sensorObserver = Observer()
    config.debug = true
    config.dbType = .REALM
class Observer:TimezoneObserver{
    func onTimezoneChanged(data: TimezoneData) {
        // Your code here..


Yuuki Nishiyama, [email protected]


Copyright (c) 2018 AWARE Mobile Context Instrumentation Middleware/Framework (

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Latest podspec

    "name": "com.awareframework.ios.sensor.timezone",
    "version": "0.4.0",
    "summary": "A Timezone Sensor Module for AWARE Framework.",
    "description": "The timezone sensor keeps track of the useru2019s current timezone.",
    "homepage": "",
    "license": {
        "type": "Apache2",
        "file": "LICENSE"
    "authors": {
        "tetujin": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.4.0"
    "platforms": {
        "ios": "10.0"
    "swift_version": "4.2",
    "source_files": "com.awareframework.ios.sensor.timezone/Classes/**/*",
    "dependencies": {
        "com.awareframework.ios.sensor.core": [
            "~> 0.4.1"

Pin It on Pinterest

Share This