chromecast-java-api-v2 icon indicating copy to clipboard operation
chromecast-java-api-v2 copied to clipboard

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

Open yanquisalexander opened this issue 5 years ago • 16 comments

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

yanquisalexander avatar Apr 07 '20 13:04 yanquisalexander

Yes, it should be possible.

vitalidze avatar Apr 08 '20 07:04 vitalidze

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

yanquisalexander avatar Apr 08 '20 14:04 yanquisalexander

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.

vitalidze avatar Apr 09 '20 07:04 vitalidze

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

yanquisalexander avatar Apr 09 '20 16:04 yanquisalexander

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

vitalidze avatar Apr 09 '20 16:04 vitalidze

Ok i will try and post the results here

yanquisalexander avatar Apr 09 '20 19:04 yanquisalexander

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

yanquisalexander avatar Apr 10 '20 18:04 yanquisalexander

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

vitalidze avatar Apr 10 '20 18:04 vitalidze

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 avatar Apr 10 '20 19:04 yanquisalexander

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<String> ListaDispositivos() { List<String> listachromecasts = new ArrayList<String>();

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

yanquisalexander avatar Apr 15 '20 12:04 yanquisalexander

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

vitalidze avatar Apr 16 '20 08:04 vitalidze

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

vitalidze avatar Apr 16 '20 08:04 vitalidze

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

yanquisalexander avatar Apr 16 '20 14:04 yanquisalexander

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

vitalidze avatar Apr 16 '20 14:04 vitalidze

Could Logcat be a good option?

yanquisalexander avatar Apr 16 '20 14:04 yanquisalexander

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

vitalidze avatar Apr 16 '20 14:04 vitalidze