cordova-appgroups-dates

1.0.1 • Public • Published

Description

This plugin helps to share data between a hybrid application and a native extension it is easy and efficient if everything is set up correctly.

Adding the Plugin

Use the Cordova CLI and type in the following command:

cordova plugin add cordova-appgroups-dates

Sample Code

The Plugin is only for iOS.

Settings AppGroup

It is necessary to configure the extension of the application as shown in the link below.

https://developer.salesforce.com/blogs/engineering/2017/02/using-ios-app-extensions-mobile-sdk.html

Save in UserDefaults

var options = {
      key: "foo",
      value: "bar",
      suite: "group.cats.catsAreAwesome"};

window.AppGroupsUserDefaults.save(options,
  function() {
     // success
  }, function() {
    // failed
  });

Load from UserDefaults

var options = {
      key: "foo",
      suite: "group.cats.catsAreAwesome"};

window.AppGroupsUserDefaults.load(options,
  function(result) {
   // success
   console.log("Result:", result)
  }, function() {
    // failed
  });

Load in Today extention in Swift

let foo = UserDefaults(suiteName: "group.cats.catsAreAwesome")!.string(forKey: "token")
    print(foo)

Package Sidebar

Install

npm i cordova-appgroups-dates

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

8.35 kB

Total Files

9

Last publish

Collaborators

  • joaoduartemariucio