Hello
How can i create extension for myself?
Thank you
Just install an extension builder first Rush or Fast
i recommend you to use Fast
[mod edit]
Create a New Project:
- Open your terminal and navigate to the directory where you want to create your extension.
- Run:
For Rush
- Open terminal at where you want to create a new RUSH project.
- Run
rush create <ProjectName>
- Enter the package name.
- Enter author name.
- Enter version name.
- select Language (eg. Java/kotlin)
- Done.
For Fast
- Open terminal at where you want to create a new FAST project.
- Run
fast create <ProjectName>
- Enter the package name.
- Enter author name.
- Done.
Navigate to Your Project:
cd your_extension_name
Develop Your Extension
- Edit the Source Code:
- Open the
src/YourExtensionName.java
file. This is where you'll implement your extension's functionality. - Use the following structure for your Java code:
package com.yourpackage;
import com.google.appinventor.components.annotations.*;
@DesignerComponent(version = 1,
description = "Your Extension Description",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "your_icon.png")
public class YourExtensionName extends AndroidNonvisibleComponent {
public YourExtensionName(ComponentContainer container) {
super(container.$form());
}
// Your methods here
}
DesignerComponent and SimpleObject annotation can be used in fast but not in rush
in rush you'll use something like this
package com.yourpackage;
import com.google.appinventor.components.annotations.*;
public class YourExtensionName extends AndroidNonvisibleComponent {
public YourExtensionName(ComponentContainer container) {
super(container.$form());
}
// Your methods here
}
- Add Methods:
- Define the methods you want to expose to App Inventor. Use the
@SimpleFunction
annotation for each method.
@SimpleFunction(description = "Your function description")
public void yourFunction() {
// Implementation
}
- Add Properties:
- Use the
@SimpleProperty
annotation to define properties.
private String yourProperty;
@SimpleProperty(description = "Your property description")
public String YourProperty() {
return yourProperty;
}
@SimpleProperty
public void YourProperty(String value) {
yourProperty = value;
}
Build Your Extension
- Compile the Extension:
- Run the following command in your project directory:
For Rush
rush build
For Fast
fast build
I hope this will help you. you can ask question if any
1 Like
Read a detailed guide of Fast here
Unfortunate, i dont have a laptop, i only have a phone and i always using a niotron ide and everytime i dont know how to set it as a extensiom
what do you mean by this
You should ask on the Niotron community.
closing
2 Likes