Ok, let’s do this: I’m going to try and make a Q&A with the extensions developers who can and want to answer super basic questions, just like “What is this?”
This is not just for me but for everyone who is not very knowledgeable in this subject. So even if I know something, I will ask it anyways to state it here and not skip anything for the ones who doesn’t know it. If you are willing to answer questions, please be prepared to explain in detail whatever you want to explain.
For an easier understanding, I will continue with the next questions after the current one is answered. So please if you have questions about something that is not being discussed yet, WAIT until we get there, so everyone is on the same page and has the same chance of learning.
==The Code Editor.==
By @Ken’s advice, We will use the AppyBuilder Code Editor, which I understand is all I need to start coding, instead of using Eclipse or something else. I also understand this doesn’t require for me to download the App Inventor source code. Is that right?
Do we need to create an account or the same account for AppyBuilder will log me in?
Excellent! so by posting that link, we don’t have to explain much more about the editor. Whoever is using this to learn from scratch, please take the time and go read it.
After you create a new AIX project, you have the template loaded and these are the first lines of the code you will see:
/** ~~~~~
* Created with the AppyBuilder Code Editor.
* This is a template for basic Extension.
* Modify this template to customize your extension.
*
* **** NOTE: DO NOT use a package name.
* **** The package name will be created for you automatically.
* **** Adding a package name will cause a compile error
*/
This is just a comment and doesn’t do anything. It only documents the code for other people who opens it.
You can create comments by starting the line with /* and ending it with */. Everything in between those will be ignored by the compiler.
My question here is What does it mean with DO NOT USE A PACKAGE NAME?
The default package name should look like this: com.appybuilder.Extension_Name
It is something like default package name in kodular for apps.
While if you use extension template or ai sources then you can use custom package name (for example in my case I use com.sunny.Extension_Name).
And this one is same as custom package name in kodular.
Adding to what @vknow360 said, one of the most common usages of package name is to prevent naming conflicts between different classes (for simpler understanding, think of classes to be extensions).
Imagine having two different extensions with the same name, say ‘MyExtension’. Now if you build your project containing both of these extensions, the build process will fail as the compiler won’t be able to resolve the conflicts that have been arisen because of the same name of the classes, or basically extensions. This is where package names help compilers distinguish between different classes having the same name.
Also, package names and the directory structure of your extensions’ source files are very closely related. For example, if your package name is com.company.myExtension (package names are usually written in the reverse domain name notation) then your directory structure must be like this:
src // This is the main source directory.
└── com
└── company
└── myExtension
└── MyExtension.java
No sooner have 2 days passed than I already have to give up my intention not to post anymore, because this topic is too interesting. Thanks for opening this. (I’m of course also a newbie.)
To create my first extension I used the Extension Template Respository (from Evan Patton).
The first line of my extension (quadraticEquation.java) is: package de.BodyMindPower.quadraticEquation; // package name of the extension
Thank you all for your replies. So let me see if I understand: in other editors you need to specify the package name in the code, like the example @bodymindpower showed us, but when we use the Appybuilder editor, that package name is generated when we get the aix file. Is that right?
Since you understand and learn very quickly, as we all know, I am sure that you will soon be able to create even these two extensions (definitely sooner than me).
That is a VERY long shot but I hope I would at least be trying something like that soon. I also hope this Q&A will make a lot more people start trying too.