Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to create an AppInventor extension from this library? #126

Open
yanquisalexander opened this issue Apr 7, 2020 · 16 comments

Comments

@yanquisalexander
Copy link

Hi everyone! As the title of my question says, is it possible to create an AIX extension for AppInventor using this library?

From what I saw in other Issues this library has been used before on Android, so I assume there is a possibility

I leave a little reference:

http://kio4.com/appinventor/125B_extensiones_crear_i.htm

@vitalidze
Copy link
Owner

Yes, it should be possible.

@yanquisalexander
Copy link
Author

https://community.appinventor.mit.edu/t/error-from-companion-java-lang-noclassdeffounderror/451?u=alexander

I share another link

There is a user who tried to perform the extension: He did it but he gets Runtime errors

@vitalidze
Copy link
Owner

Since there are no dependencies manager then all jar files must be added to the project somehow. Another option, which was suggested in that thread is to create a "fat jar" with everything included.

@yanquisalexander
Copy link
Author

In that case, what would be the other missing dependencies / libraries? 🤔

@vitalidze
Copy link
Owner

This is a maven-project. You can find all direct dependencies in the POM-file.

@yanquisalexander
Copy link
Author

Ok i will try and post the results here

@yanquisalexander
Copy link
Author

yanquisalexander commented Apr 10, 2020

Ok, I modified "pom.xml" to download each dependency separately, since the "fat jar" did not work correctly for me

I no longer have compilation or runtime errors, but I am stuck on "the main thing"

I have not been able to find a method similar to "GetDevices" in the java files here in the repository, should scanning be stopped manually?

What I want to do is something similar to this (but in code):

component_method

component_event

@vitalidze
Copy link
Owner

Looking for chromecast devices works through discovery. You can find code example in the project Readme file.

@yanquisalexander
Copy link
Author

In that case I suppose that I will use a Clock to verify every X seconds the detected Cast devices


From what I see "Chromecasts.get()" returns a list of devices in List, so I must convert to YailList to be able to use it in Appinventor

@yanquisalexander
Copy link
Author

I don't know if issue #125 will be related, but the method which in my case should return a list of Devices returns an empty list

Should any additional steps be taken?

This is the used code:

`@SimpleFunction(description = "Show list of devices detected")
public List ListaDispositivos() {
List listachromecasts = new ArrayList();

for (Object dispositivos : ChromeCasts.get()) {
        ServiceEvent serviceEvent = (ServiceEvent) dispositivos;
        String deviceName = serviceEvent.getInfo().getName();
        listachromecasts.add(deviceName);
      }
    return listachromecasts;
}`

@vitalidze
Copy link
Owner

This means that no devices have been discovered on your network (yet?). You can try turning on the DEBUG level.

@vitalidze
Copy link
Owner

Also I don't see where you have started the discovery. It needs to be started before looking for the devices.

@yanquisalexander
Copy link
Author

This means that no devices have been discovered on your network (yet?). You can try turning on the DEBUG level.

How do I do this?

Also I don't see where you have started the discovery. It needs to be started before looking for the devices.

Device discovery I set it in another block, basically like this (I use a Clock to stop Discovery):

castBtns

@vitalidze
Copy link
Owner

The project uses slf4j. You need to figure out how to configure logging in your project.

@yanquisalexander
Copy link
Author

Could Logcat be a good option?

@vitalidze
Copy link
Owner

I don't know. This is not the right place to ask such questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants