Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API client app crashes if AnkiDroid does not have storage permissions #5393

Closed
cassdeckard opened this issue Jul 25, 2019 · 3 comments
Closed
Labels
API Bug Help Wanted Requesting Pull Requests from volunteers Keep Open avoids the stale bot

Comments

@cassdeckard
Copy link

Reproduction Steps
  1. Install AnkiDroid but do not run OR remove Storage permissions from existing AnkiDroid app via App Info UI
  2. Launch API Sample app
  3. Select entry, hit share button, select AnkiDroid Instant-Add
Expected Result

Not sure. Maybe user gets prompted with dialog explaining why Anki cannot be exported to?

Actual Result

API Sample App crashes due to unhandled IllegalStateException in AnkiDroidHelper::getDeckId with message "AnkiDroid database inaccessible. Open AnkiDroid to see what's wrong."

Debug info

N/A (crash is in the app using the AnkiDroid API, not AnkiDroid itself)

Research

[ 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

Additional Note

If #5304 were implemented, this issue would likely go away.

@cassdeckard
Copy link
Author

I submitted this as an issue on the sample app, but the fix may need to happen in the API itself unless there is an elegant way for API clients to avoid this crash (in which case it should probably be documented).

This was discovered because it happens in the Wannichou app (link to issue) which exports cards to AnkiDroid.

Options we discussed in that linked thread are:

  • Add an API to check to see if AnkiDroid has access to the DB, so clients can use this before attempting to use API calls that would raise exceptions
  • Add an API to request storage permission on behalf of AnkiDroid (not sure if this is even possible)

Another option that just occurred to me would be to have the API code catch the exception and handle it by returning null, since that seems to be how most of the API methods report errors.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2020

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

@github-actions github-actions bot added the Stale label Jun 2, 2020
@david-allison david-allison added API Bug Help Wanted Requesting Pull Requests from volunteers Keep Open avoids the stale bot and removed Stale labels Jun 2, 2020
@dae
Copy link
Contributor

dae commented Aug 31, 2023

A lot has changed since then - please let us know if the issue still exists.

@dae dae closed this as completed Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Bug Help Wanted Requesting Pull Requests from volunteers Keep Open avoids the stale bot
Projects
None yet
Development

No branches or pull requests

3 participants