Implementing Send Intent to add words from Aedict to AnkiDroid

56 views
Skip to first unread message

Florian Le Bourdais

unread,
Nov 24, 2011, 10:17:33 AM11/24/11
to aedict-users
Hello Martin,

As a frequent AnkiDroid user, I recently found out that AnkiDroid
developers have developed an intent-based protocol for communicating
with other apps within Android.

I posted a question on the AnkiDroid forum concerning this (http://
groups.google.com/group/anki-android/browse_thread/thread/
d48cb2d394fb7f67), because I frequently want to add flashcards from
Aedict but until now, I had to do three copy pastes with (kanji,
reading, meaning) per card I want to add.

Would it be possible to add this feature directly into Aedict? It
would be really wonderful.
To quote nobnago from AnkiDroid forum, what needs to be done is:
"right now, AnkiDroid supports intent addition by
"org.openintents.action.CREATE_FLASHCARD" and by the generic action
"android.intent.action.SEND". So, any application which supports SEND
can export to ankidroid"

I have very little experience with this kind of thing, but am very
willing to help.
Probably the helpful people at AnkiDroid can explain details about
this procedure.
Thanks in advance for your feedback
Florian

martin.vysny

unread,
Nov 25, 2011, 5:01:48 PM11/25/11
to aedict-users
Hi Florian,
sure, no problem. Right now I don't have the time necessary to
develop this, but I hope to have more free time in the future.
It would be a great help to have an example on how to send such
intent. Perhaps if you could ask in the AnkiDroid forums?
Thank you,
Martin

On Nov 24, 4:17 pm, Florian Le Bourdais

trurlo

unread,
Nov 27, 2011, 5:43:33 PM11/27/11
to aedict-users
Hi guys,

> It would be a great help to have an example on how to send such
> intent. Perhaps if you could ask in the AnkiDroid forums?

The shortest example would be for example:

Intent intent = new Intent();
intent.setAction("org.openintents.indiclash.CREATE_FLASHCARD");
intent.putExtra("SOURCE_LANGUAGE", "en");
intent.putExtra("TARGET_LANGUAGE", "jp");
intent.putExtra("SOURCE_TEXT", "(n) aquarium/(P)");
intent.putExtra("TARGET_TEXT", "水族館 [すいぞくかん]");
startActivity(intent);

The above scenario would be as follows: the user searches for 水族館,
finds the definition, longpresses it on the list and chooses "Send as
flashcard" (or sth. similar) from the context menu. As I see it most
convenient, this action could be available everywhere where we can
send something to notepad (but instead sending it to flashcard app) -
vocabulary, kanjis, sentences.

Tomasz

Florian Le Bourdais

unread,
Nov 29, 2011, 8:47:31 AM11/29/11
to aedict-users
Hi Martin,

Thanks for your earlier response. Very happy to see you're welcoming
the suggestion. Hope you'll have some time soon :)
Do you need anything else except the above lines of code to start
developing for me to ask on AnkiDroid forum?

In the meantime, a work-around was implemented in AnkiDroid on
v1.1alpha4 where the Notepad "Send to" function is used.
See http://groups.google.com/group/anki-android/msg/0df4d3430611f40c
for details.

Cross-linking the feature request from Google code Aedict site (http://
code.google.com/p/aedict/issues/detail?id=153) for others to see.

Cheers
Florian

Reply all
Reply to author
Forward
0 new messages