2017년 3월 31일 금요일

Singleton BlockyTalky Component


Is there a procedure or precedent for creating singleton components in AppInventor? 

We're creating a BlockyTalky extension for AI. Currently, BlockyTalky entities interact by declaring their existence to a central server and communicating to each other via that server. Our current implementation makes the phone into a BlockyTalky entity and allows students to send and receive messages by naming a destination entity. Given this architecture, it doesn't make sense for a phone to have multiple BlockyTalky components, but the default behavior allows for multiples to be created.

Is it possible to enforce a single instance of a component? Is it advisable?

--
I am no expert in App Inventor but with some reading from this group, I found out that singleton components are not yet supported by AI. The reason is that AI treats every screen as separate app itself. This link might help you out.

--
There's been some talk in the fairly recent past about implementing the ability to check (and disallow) for duplicate singleton components but it hasn't been done yet.  So no, it's not currently enforceable and yes, it is advisable.

There are currently a number of components that are essentially (or should be) singletons.  They usually deal with the issue by making making certain fields and methods in the class be static.

--
Just to clarify, each Screen in App Inventor is a separate Android Activity, which is not quite the same thing as being a separate app.


--
yup, it would be cool to have an annotation to deal with this. Would
you guys be up to looking into it? We can provide some guidelines if
that helps.

--

댓글 없음:

댓글 쓰기