Extension Library concept for Extending GeneXus for Smart Devices

Official Content
This documentation is valid for:

Extension Library concept is introduced as of GeneXus 15 to ease the development of extensions for Smart Devices.

Library concept

A Library is a way to group implementation details for some extension points such as User Controls, External Objects and External Providers for Smart Devices, and it consists of two main components:

  • A XML-like file with extension *.library where the developer must list the extensibility components for each platform and their implementations.
  • The binaries and any other dependent file needed for the implementation.

The *.library file defines tags with a special semantic:

  • <ExtensionLibrary>...</ExtensionLibrary>
    Root tag which indicates the begin-end of the library file.
  • <Implements>...</Implements>
    Lists which components are implemented in the library.
    The tags for its items must match with GeneXus's object name. A few examples below:
    • <ExternalObject name="my_external_object" />
      Refers to an External Object implementation.
    • <UserControl name="my_user_control" />
      Refers to an User Control implementation.
    • <NotificationProvider name="my_notification_provider" />
      Refers to a notification provider implementation.
    • <CacheProvider name="my_cache_provider" />
      Refers to a cache provider implementation.
    • <StorageProvider name="my_storage_provider" />
      Refers to a storage provider implementation.
  • <Android>...</Android>
    Indicates the implementation dependencies for Android generator.
    Also, it defines special tags.
    • <ModuleClass>...</ModuleClass>
      Class instantiated at runtime responsible for mapping the extension to the components that use it.
    • <GroupId>...</GroupId>
      Package group identifier for Maven repository where there are AAR files that implement the library (with its transitive dependencies).
    • <Name>...</Name>
      Name of library in Maven repository.
    • <Version>...</Version>
      Version code of the library in Maven repository.
    • <GradleExtensionFile>...<GradleExtensionFile>
      Optional. A *.gradle file for library building. Use this option if you want to include external libraries references.

                       Note: Extension Libraries authors don't have to add standard Maven repositories anymore to their library definition for Android since they're now included. So, since Genexus 16 U5 it is no longer necessary to include this extension.

  • <iOS>...</iOS>
    Indicates the implementation dependencies for iOS generator.
    Also, it defines special tags (details on this site).
    • <ModuleClass>...</ModuleClass>
      Optional. Class instantiated at runtime responsible for mapping the extension to the components that use it. It is optional in the case that the only component using the extension is a User Control.
    • <PodFile>...</PodFile>
      Optional. A *.pod complete filename for indicating the library dependencies.
    • <XCProjExtensionFile>...</XCProjExtensionFile>
      Optional. An XML filename for extending the generated XCode project.
    • <CopyListFile>...</CopyListFile>
      Optional. An XML filename which lists a set of files or directories to be copied to generated project.


For example, let's take a*.library file defined as follows:

       <UserControl name="MyUserControl"/> 
       <UserControl name="MyUserControlVariant"/>
       <ExternalObject name="MyExternalObject"/>

As we mentioned before, the <ModuleClass> tag references a class where each component is initialized.

The mylibraryextension.gradle file could add the following to reference the public repository; add whatever is needed:

repositories {

Android initialization code sample

class com.mypackage.MyExtensionLibraryClassName {

    public void initialize(Context context) {

         UserControlDefinition ucDefinition = new UserControlDefinition("MyUserControl", MyUserControl.class);

         UserControlDefinition ucDefinition = new UserControlDefinition("MyUserControlVariant", MyUserControlVariant.class);

         ExternalApiDefinition apiDefinition = new ExternalApiDefinition("Module.Example.MyExternalObject", MyExternalObject.class);

         // Other components initialization.

The Library itself details which component implements. the External Object does not need to fill the platform specific parameters.

iOS initialization code sample

public class MyExtensionLibraryClassName: NSObject, GXExtensionLibraryProtocol {

    public func initializeExtensionLibrary(withContext context: GXExtensionLibraryContext) {

        GXActionExternalObjectHandler.register(MyGXActionExternalObjectHandlerSubclass.self, forExternalObjectName: "Module.Example.MyExternalObject")

        // Other components initialization, except for User Controls because GeneXus automatically generate the mapping by using the UC definition.



Note that the implementation uses Swift language. In such case, the @objc(MyExtensionLibraryClassName) notation must be used in order to instantiated this class at runtime via reflection.


Android support as of GeneXus 15 Upgrade 3.
iOS support as of GeneXus 15 Upgrade 6.

See Also

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.