Skip to content

OutSystemsExperts/cordova-outsystems-timezonewatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimeZoneWatcher cordova plugin

Adds the ability to watch for the system timezone changes on all application states: foreground, background and even closed.

Supported Platforms

  • Android
  • iOS

Installation

cordova plugin add https://github.com/OutSystemsExperts/cordova-outsystems-timezonewatcher.git

API Reference

Once installed, cordova.plugins.TimezoneWatcher is globally available and exposes the following API:

Method Description
start(title, body) Sets a default title and body for local notifications shown when timezone changes. Additionally, checks if any timezone change have occurred and delivers through a document event named timezone-changed-event
getBackgroundRefreshStatus(success, fail) iOS Only retrieves the systems Refresh Status. Possible values are:
authorized - Background updates are available for the app.
denied - The user explicitly disabled background behavior for this app or for the whole system.
restricted - Background updates are unavailable and the user cannot enable them again. For example, this status can occur when parental controls are in effect for the current user.

Usage

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    
    // ...
    
    cordova.plugins.TimezoneWatcher.start("Timezone Info", "The timezone has changed.");
    
    // ...
    cordova.plugins.TimezoneWatcher.getBackgroundRefreshStatus(function(status){
      console.log(status);
    }, function(error){
      console.log(error);
    })

    // ...

}

How it works

iOS

This plugin leverages two main features of the iOS system:

Android

A BroadcastReceiver registered to receive android.intent.action.TIMEZONE_CHANGED intent is responsible for delivering timezone change events to the application both in background and foreground states.


Support

This plugin is not officially supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from OutSystems Experts who created this component. Additionally, feel free to use the issue tracker.

Contributors


LICENSE

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.