Skip to content

victorhenrion/expo-widget-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expo-widget-info

This Expo Module allows you to get information about user-configured widgets on Apple devices.

This is especially useful for analytics usecases, in order to determine widget usage rates, which kinds and sizes are popular, how they're configured, etc.

NPM Version

Installation

expo install expo-widget-info

Usage

Apple doesn't provide an event-based API, so simply call getWidgetInfo() whenever appropriate: at launch, or perodically as a background task (do make sure the API is available, I have not tested it).

import ExpoWidgetInfo from 'expo-widget-info'

const widgets = await ExpoWidgetInfo.getWidgetInfo()

for (const widget of widgets) {
  console.log('Widget ID:', widget.id) // 7134899202873854000
  console.log('Widget Kind:', widget.kind) // MyWidget
  console.log('Widget Family:', widget.family) // systemSmall
  console.log('Configuration:', widget.configuration) // null
}

Documentation

Calling getWidgetInfo() will throw an UNSUPPORTED error when the native method getCurrentConfigurations(_:) is not available (requires iOS 14, iPadOS 14, Mac Catalyst 13, macOS 11, visionOS 26, watchOS 9 and up). Will otherwise throw native errors as WIDGET_ERROR.

Check out the related Apple Developer Documentation.

Contributing

This package is open to contributions of all kinds.

About

Get information about user-configured widgets on Apple devices

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors