Skip to content

Repository files navigation

AWARE: Timezone

Swift Package Manager compatible

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

Requirements

iOS 13 or later

Installation

You can integrate this framework into your project via Swift Package Manager (SwiftPM).

SwiftPM

  1. Open Package Manager Windows

    • Open Xcode -> Select Menu Bar -> File -> App Package Dependencies...
  2. Find the package using the manager

    • Select Search Package URL and type git@github.com:awareframework/com.awareframework.ios.sensor.timezone.git
  3. Import the package into your target.

Public Functions

TimezoneSensor

  • 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.

TimezoneSensor.Config

Class to hold the configuration of the sensor.

Fields

  • sensorObserver: TimezoneObserver: Callback for live data updates.
  • enabled: Bool: Sensor is enabled or not. (default = false)
  • debug: Bool: Enable/disable logging. (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: String?: Encryption key for the database. (default = nil)
  • dbType: DatabaseType: Which db engine to use for saving data. (default = .none)
  • dbPath: String: Path of the database. (default = "aware_timezone")
  • dbHost: String?: Host for syncing the database. (default = nil)

Broadcasts

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

Data Representations

Timezone Data

FieldTypeDescription
timezoneIdStringthe timezone ID string, i.e., “America/Los_Angeles, GMT-08:00”
deviceIdStringAWARE device UUID
labelStringCustomizable label. Useful for data calibration or traceability
timestampInt64unixtime milliseconds since 1970
timezoneIntTimezone of the device
osStringOperating system of the device (ex. ios)
jsonVersionIntJSON schema version

Example Usage

lettimezoneSensor=TimezoneSensor.init(TimezoneSensor.Config().apply{ config in
config.sensorObserver =Observer()
config.debug =true})
timezoneSensor?.start()
classObserver:TimezoneObserver{func onTimezoneChanged(data:TimezoneData){
// Your code here..
}}

Related Links

Author

Yuuki Nishiyama (The University of Tokyo), nishiyama@csis.u-tokyo.ac.jp

License

Copyright (c) 2025 AWARE Mobile Context Instrumentation Middleware/Framework (http://www.awareframework.com)

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

http://www.apache.org/licenses/LICENSE-2.0 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.

About

Aware Timezone : A Timezone Sensor for AWARE Framework iOS

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages