Zeemote support

193 views
Skip to first unread message

iniju

unread,
Oct 11, 2012, 5:55:54 PM10/11/12
to anki-a...@googlegroups.com
Hi all,

Not sure how many users have zeemote, but I've implemented, actually re-implemented, support for it.

The zeemote support is in the form of an AnkiDroid plugin:
You install the AnkiDroid-Zeemote plugin on the device that also has AnkiDroid and AnkiDroid should detect it and provides an entry in Preferences->Plugins for you to enable it.
Once enabled there (and assuming bluetooth is enabled) ankidroid will start the service that this plugin provides and use it to communicate with the zeemote. Once AnkiDroid closes, the service should close too.

Although the zeemote plugin does use proprietary library (zeemote's one), it doesn't expose it to AnkiDroid, so AnkiDroid can remain 100% open source.
The communication between AnkiDroid and plugin happens via Messenger class and follows a very simple generic protocol (that I made up), so potentially the AnkiDroid side (ControllerManager.java) could be used for other controller plugins too.

I pushed the AnkiDroid side of the changes (plugin detection, controller-manager and activities message listeners) in a separate branch, because it hasn't been tested enough and we're quite close to releasing the new version, so it should wait for the next one.
I do intent to add an .apk with it though in the Downloads section of the issue tracker (unless anyone objects), so that the users that need zeemote can have it alongside the goodies of the latest version of AnkiDroid.

Finally, the plugin itself can be found here:
The controls should be exactly like the ones in trurlo's original version.

I'd like to publish it to my account in Google Store, to get some experience with the the publishing side of Android apps, but apart from that feel free to add to it.
Again, unless there is an objection, I'd like to add an .apk of this plugin to the downloads section of the issue tracker too, for those that want to try it.

To get zeemote support, you'll need both the Ankidroid-changes in branch zeemote_plugin and the plugin itself.

Nicolas Raoul

unread,
Oct 12, 2012, 1:41:32 AM10/12/12
to anki-a...@googlegroups.com
Great!!

I guess it will have to wait for 2.1 but that's a wonderful news!

When you publish it (Play+APK downloads), you might want to warn that
it only works with the zeemote_plugin version of AnkiDroid (for which
you can put an APK in the downloads)

When I have time I will try to make a audio-only deck, and buy a
zeemote so that I can review while jogging :-)

Thanks a lot!
Nicolas Raoul
> --
> You received this message because you are subscribed to the Google Groups
> "AnkiDroid" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/anki-android/-/j2hoRtPETXwJ.
> To post to this group, send an email to anki-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> anki-android...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/anki-android?hl=en-GB.

Ruz

unread,
Oct 12, 2012, 3:26:39 AM10/12/12
to anki-a...@googlegroups.com
Thanks!
Do you plan to support the headset or some another devise? (It is difficult to find a zeemote).

пятница, 12 октября 2012 г., 1:55:55 UTC+4 пользователь iniju написал:

Nicolas Raoul

unread,
Oct 12, 2012, 3:32:59 AM10/12/12
to anki-a...@googlegroups.com
Hi Ruz!

Which headset are you thinking about?
Now that Kostas has implemented it for Zeemote, you could try copying
it and modifying it for another device :-)
How about giving it a try?

Cheers!
Nicolas Raoul
> --
> You received this message because you are subscribed to the Google Groups
> "AnkiDroid" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/anki-android/-/n3yHBgpnmuIJ.

Flavio Lerda

unread,
Oct 12, 2012, 4:06:40 AM10/12/12
to anki-a...@googlegroups.com
Great news! I am really excited about the plugin idea.
I think in the long term will make AnkiDroid much more useful and easier to use and develop.

I did not look at the code in too much detail, but I think it would be helpful to have some basic permission added for plugins (at least I could not see one at the moment).
I think AnkiDroid could define a permission that plug-ins much have for them to work with Anki.
It seems otherwise malicious third-parties might come up with something that can be dangerous for the user.

What do you think?

If you have questions about permission checking, feel free to ask me as I have done some work along those lines before.

-Flavio

--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/anki-android/-/j2hoRtPETXwJ.

To post to this group, send an email to anki-a...@googlegroups.com.
To unsubscribe from this group, send email to anki-android...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/anki-android?hl=en-GB.



--
Flavio Lerda

iniju

unread,
Oct 12, 2012, 4:15:12 AM10/12/12
to anki-a...@googlegroups.com
Hi Ruz,

The plugin as it is now (or with slight mods) is supposed to be able to handle other controllers as well, as long as they have bluetooth HID profile, which I'm not very clear what it covers and I haven't tested it. I guess if someone has a bluetooth keyboard they could give it a try? Although I can't guess how the keys would map to the plugin, because right now, the controls are not configurable, but that's just because I wanted to get a first version out asap. There's provision for adding this later and in fact is my next goal.

The ankidroid side is zeemote agnostic, so any input device like voice/microphone could utilise it. Of course someone would have to write the voice-input-plugin.

Kostas

iniju

unread,
Oct 12, 2012, 4:38:30 AM10/12/12
to anki-a...@googlegroups.com
As it is now, before the plugin is called, or utilised in any way, the user has to explicitly enable it from the preferences and there they can see the name and the package of it, so at least there's some protection from a malicious plugin using the same name as an innocent one.

The detection of the plugin happens with intent filtering, but no intent is sent, so there's no interaction before the user enables it.

As it is AnkiDroid that wakes up the plugin, not the other way around, I think we can only setup the opposite kind of permission (which is not very useful, but maybe a good idea anyway), ie that the plugin requests for a certain permission from the apps that are going to use it and presumably AnkiDroid would have in order to start it.

iniju

unread,
Oct 12, 2012, 5:26:41 AM10/12/12
to anki-a...@googlegroups.com
For those that want to modify this for another device, here's some useful points:

- The class PluginManager in AnkiDroid detects/enables/disables plugins and builds the relevant entries in the Preferences based on which plugins are installed.

- The PluginManager detects as plugins anything that listens to intent "com.ichi2.anki.plugin.action.USE_PLUGIN". It then tries to identify what kind of plugin it is, so that the right interface/protocol can be used.
Obviously right now there's only one type called controller and is identified by the category of the intent which must be "com.ichi2.anki.plugin.controller" for controllers.

- All controller plugins are supposed to be handled by class Controller manager. It does a lot of things:
1) It asks the plugin manager if there is any controller plugin enabled (and installed).
2) If found, it tries to enable and goes through an initialization phase that is captured by modes:
- isBound, meaning the plugin service has started and it can send and receive messages to AnkiDroid.
- isConnecting, the service is waiting for connection to the controller to be established.
- isConnected, controller is connected.
- isListening, ankidroid is listening for controller actions, meaning the plugin service should send them to ControllerManager and ControllerManager should propagate them to listening activity.
3) Keep track of which activity is listening for controller actions.
4) Shutdown the plugin on exit.

- The ControllerManager itself is controlled by activities (or FragmentActivities) that inherit from AnkiControllableActivity (or AnkiControllableFragmentedActivity) and that implement IAnkiControllable interface. Most of these should just implement the handleControllerMessage method that tells the activity how to interpret the controller actions and the getSupportedControllerActions, the latter not ready yet.

- The entry activity of AnkiDroid (DeckPicker) also overrides the canStartController and canStopController so that they return true. This is the only activity that asks the ControllerManager to enable/disable of the plugin. The other activities can listen for actions, but can't start/stop the plugin.

- The mapping of actions that Activities support and Actions that Controller supports should happen on the ControllerManager level, so that the activities don't have to know anything specific to the controller-type. Basically the activities provide the manager with what actions they can do and the controller plugin provides the manager with all available actions it can do and a preference screen should let the user decide to map this to that.
The controller plugin should also provide a default mapping, in case the user hasn't defined one.

Let me know if you have any suggestions for the ControllerManager workflow as it should cater for all different types of devices we want to support. I'll try to write up a more comprehensive description of the initialization process.

Kostas


On Friday, 12 October 2012 08:26:39 UTC+1, Ruz wrote:

iniju

unread,
Oct 12, 2012, 5:41:29 AM10/12/12
to anki-a...@googlegroups.com
Weird formatting, not sure how it happened, trying again...

gravel

unread,
Oct 14, 2012, 2:06:15 PM10/14/12
to anki-a...@googlegroups.com
Kostas - Great news and thank you for the efforts.  I look forward to trying the plug-in!

Nicolas - AwesomeTTS makes creation of audio-only or audio-enabled cards/decks simple.  Right now one can convert 1 card at a time, but the author (Arthur) is working on a mass-generator now.  You can see more at https://groups.google.com/forum/#!topic/ankisrs/PAJ88n2oL78.

Flavio Lerda

unread,
Nov 5, 2012, 7:46:53 AM11/5/12
to anki-a...@googlegroups.com
If anyone is interested in handling the standard media buttons, have a look at:
and you can ask me for details. I have built a small demo app relating to media buttons before
and I might be able to provide some assistance on that topic (but I have no time to implement it
myself, at least not right now).

-Flavio


On Mon, Nov 5, 2012 at 9:54 AM, <2011t...@googlemail.com> wrote:
I like the idea with using a standard bluetooth headset. For example I have a standard one from Samsung, that has buttons for controlling an audio player. I think those should be rather standard functions since it works with a lot of programs. It would be a real boost, to use anki with the standard BT headset you already have with you all the time. F.e. the rewind button could be used for "again", the forward button for "suggested answer" tha play/pause for "replay audio". long-press on forward for "better than recommended", long-press on rewind for "suspend".

--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/anki-android/-/k350oj_ZQRwJ.

To post to this group, send an email to anki-a...@googlegroups.com.
To unsubscribe from this group, send email to anki-android...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/anki-android?hl=en-GB.



--
Flavio Lerda

iniju

unread,
Nov 6, 2012, 10:37:52 AM11/6/12
to anki-a...@googlegroups.com, 2011t...@googlemail.com
Since I'm already working on the zeemote plugin, I'll have a look to see how difficult it is to adapt it to media buttons from bluetooth headset.

But, it will be like 2-3 weeks before I get around it though, as I have no free time until end of November, so if anyone else is interested, feel free to jump on it. It'd be nice to have this in the same package as the zeemote plugin, if possible.

cheers


On Tuesday, 6 November 2012 13:56:25 UTC, 2011t...@googlemail.com wrote:
I am sorry, but I have no idea of programming... Anybody interested in implementing it?

ome...@gmail.com

unread,
Aug 8, 2014, 9:34:28 AM8/8/14
to anki-a...@googlegroups.com
Hello,
I tried to install the APK from here, yet I don't have a "Preferences->Plugins" in Anki. Am I missing something? Can this plugin work on AnkiDroid 2.2.3?

Thanks very much,
Omer
Reply all
Reply to author
Forward
0 new messages