ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.43k stars 2.19k forks source link

New feature "Display a card on Screen unlock" #4709

Closed rafenciugo closed 3 years ago

rafenciugo commented 7 years ago
Research

Enter an [ x ] character to confirm the points below:

[ x] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid

[x] I have checked the manual and the FAQ and could not find a solution to my issue

[x] I have searched for similar existing issues here and on the user forum

I would like to propose a new functionality that could significantly help AnkiDroid users to boost their learning process.

Problem: Right now, to study cards, it is necessary to start a learning session manually. That means that a user has to find time to do it and be motivated. It is much more difficult to motivate children to work with AnkiDroid although they use mobile phones all the time.

Solution: Imagine that it is possible in AnkiDroid to enable a feature "Display a card on Screen unlock". If enabled, every time when a user unlocks a screen of his mobile phone a single card is displayed. The user can answer the question in the same way that he does it in AnkiDroid, and continue doing what he was supposed to do with his phone. Or, if he needs to use his phone urgently, uses an additional button "Abandon" or a main button of the phone that minimalizes all the applications. In that case, a card disappears but remains unanswered, and the user can use his phone. The card is displayed on the next screen unlock or in the standard AnkiDroid session if the user decides to do it.

Now imagine how many times, during a single day, you unlock your phone. At least 50 or more, could be 100. Using a "Display a card on Screen unlock" feature:

I have done an experiment myself, turning on AnkiDroid manually on every screen unlock during two weeks. The results are incredible. I have caught up with all my outstanding cards and have done an impressive progress, without spending a minute in dedicated sessions. Turning AnkiDroid every time manually was a pain in the a..., but the "Display a card on Screen unlock" feature would be a gift.

The next step could be implementing a feature "Display a card on Starting an application". This could work in the same way as described above but the cards would be displayed when the user starts some (configured) applications. For instance, a child starts his favorite game or youtube, before he can use it, a single card is displayed.

I would appreciate it if a person responsible for AnkiDroid backlog management could consider adding this feature to that backlog.

I am ready to provide a very detailed description of this new and powerful feature "Display a card on Screen unlock". I could also engage as a tester.

jozefwczasy commented 6 years ago

Hi rafenciugo,

I work in management, most of the time on the phone and half of the day on the underground. Unlocking the phone and at the same time clearing back log of Anki cards? Genius! Beautiful! What else does one need...? How much time a day do you guys spend on the phone (tablet) a day? I think it is an excellent idea!

rafenciugo commented 6 years ago

Hi Josef, thank you very much for your comment and confirmation that the idea described above (displaying a single card on screen unlock) would also work in your case and would accelerate your learning process. I have talked to some Anki users after publishing the description above, they are really looking forward to contributing, mainly in the terms of testing, because they are not programmers.

BTW, guys, how many times a day do you unlock your phone? I do it about 100 times. At the beginning, I thought I was an addict but now I know that it is not that many. Normally people do more. How about you?

Kind regards, R.

luc-vocab commented 6 years ago

This is an awesome idea. Want to waste some time at your phone ? have to pay for it with some reviews first ! With a circumvention mechanism in case of extreme urgency only.

coltongrainger commented 6 years ago

A circumvention mechanism? Maybe only for emergency calls.

Related: https://imgs.xkcd.com/comics/tar.png

rafenciugo commented 6 years ago

I imagine that the AnkiDroid should display a single card (or configured number cards) automatically on ScreenUnlock, but.... the user should always be able to simply reject the card. Reviewing the card is totally voluntary. Of course, it would be nice to have some statistics, how many times a card was answered and how many times was rejected.

worthy7 commented 6 years ago

Btw, this should be generalized into "make a better widget".

rafenciugo commented 6 years ago

As far as I know, there are two widgets available right now. One simply opens the AddNewCard form, another one, displays a number of reviews pending and simply opens the AnkiDroid. Worthy7, do you think of implementing another widget "Display a card on Screen unlock"? I thought it should be implemented an integrated feature of AnkiDroid.

worthy7 commented 6 years ago

Yea I agree, TinyCards is going to take over Anki at this rate. Basically a mini ankidroid as a widget is all we need.

mo271 commented 6 years ago

I think this would be a great feature! I want to do something similar with for an app that I wrote that quizzes you on random dates (you are supposed to guess the day of week). Is there any open source android app which does something similar?

mo271 commented 6 years ago

One could think about, whether the behavior should come from the app, or if it should rather be managed by another app. Imagine having two or more programs that compete for being the app opened after unlock.. The app Hangar provides a widget on the lockscreen, that can display the anki symbol and if you click on it it opens the app automatically. https://f-droid.org/packages/ca.mimic.apphangar/ While it is not exactly what @rafenciugo was asking for, it is already more convenient then opening anki every time by hand. Also there is this old app, which seems to be not maintained and not open source: https://play.google.com/store/apps/details?id=se.webworks.android.apponunlock&hl=en

worthy7 commented 6 years ago

It basically need's to be a widget built into Ankidroid. It needs to have access to Ankidroid code to do the reviews.

SergioGeeK7 commented 6 years ago

I would fucking love this feature, if I don't find one app that does this, I'll struggle as much as I can to make this possible. I'm a developer yet not for Android However I want to help.

mikehardy commented 6 years ago

I don't believe Android allows lock screen widgets anymore. However there are notifications you can interact with. Perhaps most of the review logic could be stuffed into a notification so you could display card and have a flip action then display the back side with answers. No idea if that could work but a proof of concept tiny app with static content would show

SergioGeeK7 commented 6 years ago

Hi @mikehardy, it does support, I just used https://play.google.com/store/apps/details?id=net.wordbit.enes it works like a charm yet does not let you add cards or create decks

SergioGeeK7 commented 6 years ago

Also https://play.google.com/store/apps/details?id=co.unlockyourbrain

mikehardy commented 6 years ago

Interesting. I continue to assert that lock screen widgets are dead, they are no longer available after lollipop.

The feature as originally described is also not possible - the system will no longer deliver events to apps when the user is present or when other apps open as of Android 8 / Oreo. It's a cool idea but Android will not let you implement that.

Replacing the lock screen is something you can still do, and I believe these two apps do that. However, there's a strong argument that lock screens themselves are a dead-end for customization. Smart Unlock, iris scanning, fingerprints etc - all of these interact with phone locking and it's an area the handset manufacturers are innovating on rapidly, meaning trying to interfere with it would be a maintenance problem (e.g., we develop a lockscreen but it breaks fingerprint or iris scan -> angry users). Which is TL;DR for messing with the lock screen isn't really a thing in Android anymore, esp not for a small development team.

So getting in the flow between a user and their unlock or a user and another app is being designed out actively by Android and I wouldn't want to fight that.

However! Android is actively trying to allow apps to display snippets the system thinks the user will want. Slices and notifications fit that. The system will prioritize ones users interact with and will hide or kill ones that aren't used.

Now, we are working on notifications (currently just for work reminders), and it is possible to make highly interactive notifications, especially if the style of interaction is like Anki - where you need a press for a card flip, then one of a few buttons. Imagine if Anki lodged a notification that was actually your next due card? The system would take care of showing that on the lock screen if you wanted, or just in your day to day. That's something the system is actively trying to do well vs something we'd have to fight it for.

Either a lock screen or an interactive notification could be done as a proof of concept using the CardContentProvider (it'll give you the next card if you want, and let you log an answer). I've looked into this pretty deeply this morning and I'd need to see a proof of concept before spending more time on it

worthy7 commented 6 years ago

https://stackoverflow.com/questions/2803069/android-unlock-screen-intent

I'm not an android dev, but could we not use this to launch the app with some "parameter" which will make the app open Study of whatever deck the user specifies in the settings? Something like that?

mikehardy commented 6 years ago

No, they limit which intents are receivable starting with 8 / oreo, which is already around 40% of our new installations (combined with 9 / Pie)

https://developer.android.com/guide/components/broadcast-exceptions

It would be neat, I too would like it - but it is fighting where the platform is going and that is a tough path to go down

After the study I did on it this morning and reported on above, a very dynamic notification is the only path I personally see as workable, and at least that path is something the platform is encouraging at the moment

worthy7 commented 6 years ago

Fair enough Mike, thanks for investigating

On Thu, 20 Sep 2018 at 13:58, Mike Hardy notifications@github.com wrote:

No, they limit which intents are receivable starting with 8 / oreo, which is already around 40% of our new installations (combined with 9 / Pie)

https://developer.android.com/guide/components/broadcast-exceptions

It would be neat, I too would like it - but it is fighting where the platform is going and that is a tough path to go down

After the study I did on it this morning and reported on above, a very dynamic notification is the only path I personally see as workable, and at least that path is something the platform is encouraging at the moment

ā€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ankidroid/Anki-Android/issues/4709#issuecomment-423040320, or mute the thread https://github.com/notifications/unsubscribe-auth/AEirH2RgzaV_W6CwRvrOcXXJ6aNajFUNks5ucyB7gaJpZM4Pg5mV .

mikehardy commented 6 years ago

On the plus side, I have only been an "android developer" since December, and a "very dynamic notification" (or at least a proof of concept for one) is totally doable as a project for anyone new to things

sks4903440 commented 5 years ago

Just wanted to state that U-Dictionary provides a similar feature where it displays you a card with a word on the lock screen and you can check the meaning of the word on tap as well as mark it favorite on clicking another button. You can slide for other words. Can we do something like that or it will mess with unlocking?

mikehardy commented 5 years ago

Interesting, @sks4903440 - I looked and by the look of the image on their app store listing, and that they require the "disable screen lock" permission, I'm guessing they are going down the route of replacing the lock screen. I haven't tried it personally, but if you have it installed you could tell us instead of me guessing. Does it replace your entire lock screen, or does it just add something to the standard lock screen?

SergioGeeK7 commented 5 years ago

Hey guys, I discovered there's an app that does just what we wanted, is amazing, I tried for 15 days before publishing here just to make sure it worked, here's the link. it works along with anki, I love it

https://play.google.com/store/apps/details?id=morisson.ankihelper

mikehardy commented 5 years ago

Also very interesting - I remain convinced that lock screen replacement is a dead end for the future in Android, but for other older APIs, great - and it's obviously great that someone has something working that fits people's needs now. It looks like it's using the AnkiDroid API which is the whole point of AnkiDroid having an API, people can do whatever they want with it :-). I'd still love to see a "modern" (read as: non-lockscreen-replacement) take on card display / answer like a rich notification but hopefully everyone here can take advantage of AnkiHelper. In the app store description it said "open software" but I was unable to find any source for it. That's not a problem (you can use the API however you want), just curious if anyone's able to discover code for it.

sks4903440 commented 5 years ago

@mikehardy Sorry for the late reply. The app places an additional screen on top of the lock screen. When you use your fingerprint, the phone unlocks and when you use the power button, the app shows the word screen. You can swipe up for the lock screen. When you double tap the screen it shows the lock screen. Above mentioned behaviour is on Motorola G5S+ with Android Oreo.

mikehardy commented 5 years ago

Looking for something unrelated, found the link to the notification style that would fit best for the "fancy notifications" branch of thinking https://developer.android.com/reference/android/support/v4/app/NotificationCompat.DecoratedCustomViewStyle

If the implementation @sks4903440 saw isn't too hard maybe the lockscreen path is still viable though - I haven't seen the code for it so don't know

JulyMorning commented 4 years ago

still would be great to have it. I just tried to use the app above (isn't available on gp, but easily findable). it doesn't read decks right. I just cannot choose the one deck I want: it checks s lot of other decks alongside + keeps showing the same deck I didn't choose. Good news: with tasker app or something even more powerful as xposed edge pro you can make any trigger you want and it will work like a charm, because this app has an explicit activity to show a card. For example, I've set to open the activity when screen lights up if gps is off, no one is ringing and no music on the background (if the reason to take a phone was a willing to switch a track), it shows a card right after lighting up (rven without unlockingl. Meanwhile the native feature of the app is turned off. It's easily possible to show the card randomly with tasker too. Or when you open social nets, you name it. The problem is that it's showing dome random decks, I can't tame it. Is it only my problem? Maybe there were some huge api changes that broke things?

Still it's possible to create separate account or make an anki clone with a limited number of decks so it will work anyway.

Ankidroid devs, please, make a simple activity to show just one card + an option to choose decks, thats's it. It sounds pretty doable to me, and it could make things easier.

mikehardy commented 4 years ago

This is the perfect use for the API. I am still against this in core, it would be a device- and android-level-specific fracture of an implementation I think. Regardless, no one has proposed code and in this area code will talk

JulyMorning commented 4 years ago

I kinda managed to make use of the native AnkiDroid .Reviewer activity which shows a card too, but:

  1. It shows a next card right after your answer ā€“ it may affect stats
  2. I needed to force cloze anki with the help of tasker and its plugin called AutoInput (the trigger is a click when the buttons "again", "good", "easy" etc are shown). It may affect the loading speeds, because of the unloading the app from memory.
  3. Can't choose multiple decks: it shows cards from the last used deck/study session.
  4. Overall, it's not as neat as it could be. But still it can work with any imagiable trigger.

Yeah, I know, that making this under-the-hood activity seems too specific, but yet it's pretty simple thing to do. As an alternative, it would be just freaking huge if you'd make use of the tasker api. Tasker has a great community, lots of apps can communicate with it, even if it's not advertised much. This way it may become a lot more than simple showing a card. Tasker can parse data, so it could become an instrument to make new cards too.

david-allison commented 4 years ago

Is the AnkiDroid API not sufficient for what you're looking to accomplish?

https://github.com/ankidroid/Anki-Android/wiki/AnkiDroid-API

JulyMorning commented 4 years ago

Is the AnkiDroid API not sufficient for what you're looking to accomplish?

https://github.com/ankidroid/Anki-Android/wiki/AnkiDroid-API

Seems great that it already has a way to communicate with tasker, but it requires to have some knowledge which most users including me don't have, unfortunately. Operating with tasker plugins is much easier. Maybe you could help figure out how to make what we want with the AnkiDroid api?

david-allison commented 4 years ago

This isn't a feature that I'd be interested in taking on, as I have other priorities within the project (sorry!), but it should be possible to extend AnkiDroid to do what you need via the API.

Take a look here for SCHEDULE or ReviewInfo: https://github.com/ankidroid/Anki-Android/blob/master/api/src/main/java/com/ichi2/anki/FlashCardsContract.java

mikehardy commented 4 years ago

@JulyMorning @david-allison-1 we maintain a fully functional (or it should be anyway) Sample app that is an API client, so most of what you need in order to get started making an AnkiAndroid API client is all done for you. Try forking that, re-purposing it to integrate the Tasker API, and should be all set? https://github.com/ankidroid/apisample

That said, the Tasker API is already partially done, you can use it to do syncs for instance:

https://github.com/ankidroid/Anki-Android/blob/5b5afadaf3be5fc7456ae50c89ff2e0921e0db3d/AnkiDroid/src/main/AndroidManifest.xml#L174-L178

It's on the 'IntentAction' so I suppose you could add a different intent filter with different direction to the intent filter and have it be "show one card", but that's not something I'd merge. This is why we have the API

vocabwidget commented 4 years ago

hi everyone,

forgive me for intruding -- and forgive me for probably not yet understanding social good practice on github. i hope it's ok if i post my question here, because i'm at a point where i have to reach out. i signed up for github solely to meet anyone who can help me either (a) find or (b) talk somebody, somewhere, into creating the specific function that user rafenciugo has brought up. i have been looking for a tool that will do this for literally 21 years. every few years i scour the internet. in the late 90s, i thought a desktop screensaver would do the job. when smartphones arrived, i thought it would only be a matter of time.

i'd like to message with anyone who is interested in exploring this further with me. i think i understand that ankidroid involves tests, or some gamification, and that this could be a problem when it comes to integrating the function. but to be clear, the function that would 'complete me' has two or three components:

  1. ability to select and define a word while reading normally in any app by highlighting it, with the option to add it to a custom wordlist/flashcard list
  2. a lock screen OR home screen widget that perpetually cycles through items on the vocabulary list that you have designed for yourself. when you're looking, it's there. passive exposure to salient material.

i'm just mystified. i've seen one app in the playstore that will do this, but it doesn't work, and the developer does not answer emails.

as we drive around our towns, we perpetually encounter advertising billboards. in our peripheral vision, every day, we become aware of cheeseburgers. admit it: each of suffers from incidental, involuntary cheeseburger awareness. but imagine a world in which these billboards displayed information we're trying to learn. consider that learning can be "something that happens to you" instead of something you sit down to grudgingly do.

now imagine that your phone can do this for you.

JulyMorning commented 4 years ago

@vocabwidget I'm not a big programmer to help, but I love your spirit. You may want also to check out the app with some name I can't recall, but I guess you can easily find it with words: "prime picture screen unlock". It doesn't solve anything even nearly, but it works on the same passive principle and utilizes so called prime effect to make you remember stuff. The AnkiDroid feature we discussed here is still wanted, because I don't really have needed skill to do it myself, my bad.

luc-vocab commented 4 years ago

@vocabwidget have you thought about commissioning a developer to make your idea happen? Do you already have a deck in Anki that contains the facts you want to memorize?

mikehardy commented 4 years ago

Create the smallest app you can think of first.

Just install AndroidStudio and have it generate the default app (this is easy I promise) Have the code do nothing but generate a local notification that says "this could be a vocabulary word" Confirm you see that notification on your lock screen (use an emulator from AndroidStudio to do the testing, also pretty easy)

Now go to the ankidroid API sample app: https://github.com/ankidroid/apisample

It will show you how to ask for "the next card due" Show the front and back in the notification from before Confirm you see it on your lock screen

You are started!

Further improvement: any time the notification is dismissed, the application responds by making a new notification with the next card.

Etc

I'm not being snarky, this is how to start it

luc-vocab commented 4 years ago

Yea I agree, TinyCards is going to take over Anki at this rate. Basically a mini ankidroid as a widget is all we need.

Tiny cards is shutting down. https://support.duolingo.com/hc/en-us/articles/360043909772-Tinycards-Announcement#:~:text=Since%20Tinycards%20will%20be%20shut,this%20post%20for%20more%20information.

luc-vocab commented 4 years ago

@mikehardy is right, lockscreens can't be done in Android right now. I think something creative can be done with Bubbles API which will be generally available in Android 11.

mikehardy commented 4 years ago

Lock screens can be done. But the way in will be with persistent, interactive notifications. Like the notification presented by your favorite music player, where you can rewind, pause, forward etc. Android can do that. But AnkiDroid does not need that in the core. It would be done as a consumer of the Ankidroid API, with a simple app using it for card fetching / scheduling, but handling all the notification posting etc itself.

Starting with a simple notification as I detail above is the way to begin

mikehardy commented 4 years ago

Would be great if someone exported all the TinyCards decks to shared decks on AnkiWeb via their automated tools if it hasn't been done already. They apparently invested some in creating curated content and it would be a shame for that to not be available to everyone https://forum.duolingo.com/comment/39200018

vocabwidget commented 4 years ago

thanks everyone. i might look into what mikehardy is suggesting. and another possibility is to commission the development, yes. i've been thinking that could be the next step, though i'm not sure how to find a person who would do it. i could probably mount a search. i'm thinking it may be the way to go because i feel like a key part of it is the dictionary lookup feature. the way this would ideally work is that i'd be able to define any word that i encounter online by highlighting and getting some sort of popup definition, and there i'd be able to choose whether to add it to my list or not. combine that with the home screen widget which cycles through my words and the whole system would work essentially automatically, which is my entire goal. i actually think a home screen widget is preferable to a lock screen widget, too.

there are plenty of fine apps we can use to really drill ourselves on vocab, but studying in that way requires goal-setting and a certain kind of engagement and follow-through. i don't want the drudgery of work to spoil the joy of words. so i'm imagining this as a very simple app that's targeted at readers and word-collectors, something for people who want to improve their vocabulary without trying too hard. if you read a lot, often you run into a word that you sort of know, but it's not part of your working vocabulary. a lot of these are workhorse words that you'll see here and there, so you already know something about their general frequency. they stand out as worth knowing, but you don't want to devote a season of your life to studying a huge list of, say, GRE words, simply because the utility of a given word isn't always guaranteed and because there's just something about memorizing things that you dont care about in order to burn in the things that you do which is inefficient and somehow a turnoff. hell, sometimes you just dont like the feel or sound of a word. it might do solid work, but you'd feel ridiculous using it.

an app like this would enable readers to improve working vocab in an idiosyncratic way just in the course of reading normally. i think that there should be a high demand for such a thing, and i've just never understood why it hasn't emerged.

luc-vocab commented 4 years ago

@vocabwidget please give me your email and we can discuss this further

vocabwidget commented 4 years ago

lucwastiaux, i emailed you a few weeks ago, but i may have done it wrong. i'm sorry if i'm using the forum incorrectly everyone -- this thread probably gets resurrected now for a spell -- but i'm new here. if lucwastiaux or anyone wants to talk about this, i would be interested. i can be reached, conveniently enough, at vocabwidget at gmail

luc-vocab commented 4 years ago

ah I saw your email but couldn't connect the dots earlier. I responded just now.

thiswillbeyourgithub commented 4 years ago

Would be great if someone exported all the TinyCards decks to shared decks on AnkiWeb via their automated tools if it hasn't been done already. They apparently invested some in creating curated content and it would be a shame for that to not be available to everyone https://forum.duolingo.com/comment/39200018

I can't find an archive anywhere. Did they open the access to their files or do users have ot manually export it? It would be great if they just made a torrent or something. Woudldn't cost them much. Am I missing something? I basically just discovered TinyCards tbh

luc-vocab commented 4 years ago

@thiswillbeyourgithub users had to manually download their content from tinycards. So I doubt you'll find a big archive with everyone's decks.

github-actions[bot] commented 3 years ago

Hello šŸ‘‹, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

thiswillbeyourgithub commented 3 years ago

Hey guys, I have been giving some thoughts about all this and was interested to get your opinions.

Basically, why not make a simpler version of this that would be more robust to the new android changes?

Here's what I'm imagining :

Each time you unlock your phone for more than 30 seconds (in case you really was just looking at one quick thing) a notification appear, prompting you to do 10 reviews. You click on the notification and it shows you a preordered list of you decks to decide where those reviews will be picked from. You then do 10 cards (be it reviews, learning, new etc) and after that it simply asks you if you want to continue (not to overdo it I guess).

To me, if everytime I unlock my phone I get a notification offering 10 quick reviews without having to open the app / choose a deck / worry at my growing due review list etc that would be incredible already. Of course, if you unlock your phone several times you will have several notifications like this one.

I think it would be a good idea to avoid doing filtered deck automatically, but to really act like you just clicked on the deck.

The only new settings would be :

Thoughts?

mikehardy commented 3 years ago

Make a separate app using the AnkiDroid API