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 for adding cards fails on Android 7 (Flyme 7.0.3.1A) #5114

Closed
vi opened this issue Nov 10, 2018 · 10 comments
Closed

API for adding cards fails on Android 7 (Flyme 7.0.3.1A) #5114

vi opened this issue Nov 10, 2018 · 10 comments
Labels
Needs Author Reply Waiting for a reply from the original author

Comments

@vi
Copy link

vi commented Nov 10, 2018

Reproduction Steps
  1. Install AnkiDroid on Meizu 15 Plus
  2. Build and install the API sample
  3. In Android's app settings, manually change "Read and write to the AnkiDroid database" from Ask to Allow, both for AnkiDroid itself and for the API sample.
  4. Ensure API is enabled in AnkiDroid settings.
  5. Try importing something
Expected Result

Something is imported

Actual Result

After long-ish delay the API sample crashes.

11-10 13:49:42.340 E/AndroidRuntime(32669): java.lang.IllegalArgumentException: Unknown URL content://com.ichi2.anki.flashcards/decks

My own app (TextImporter) gets null from getDeckList call (immediately if API is turn off in AnkiDroid's advanced settings, after delay if it is enabled).

Debug info

ankidroid version = 2.8.4 android version = 7.0 acra

Research

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

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

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

@mikehardy
Copy link
Member

Try installing ankidroid and allowing permissions then installing the sample. We have had a similar issue solved this wsy. No idea why

@vi
Copy link
Author

vi commented Nov 10, 2018

Do you mean uninstalling, then installing?

@mikehardy
Copy link
Member

Yes, the previous problem we saw was that if ankidroid was not installed and I think with permission enabled before the API consumer was installed, it did not work. We don't know why as my read on manifests indicates we have the necessary declarations in ankidroid

@mikehardy mikehardy added the Needs Author Reply Waiting for a reply from the original author label Nov 11, 2018
@vi
Copy link
Author

vi commented Nov 12, 2018

Uninstalled AnkiDroid, installed it again from F-Droid, launched, accepted one permission (access storage).

Both API sample and my app started working.

@mikehardy
Copy link
Member

Sounds like the same thing we saw with the previous issue. We are not able to fix this that I know of as it appears to be a quirk with permissions. Our recommendation for the developer of the other application was to include this information prominently in their documentation - that AnkiDroid needed to be fully installed prior to installing the API-consuming app.

I can't find the existing issue anymore, but I wonder if it's related to this at all: ankidroid/apisample#2

@vi
Copy link
Author

vi commented Nov 12, 2018

Note that I didn't reinstall the API sample or TextImporter. It started working after reinstallation of AnkiDroid alone.

@mikehardy
Copy link
Member

Hmm. the combination matrix of all the things to test (which to install first, try to access permission first or not, grant permission from one or the other app or both) is a bit tedious but it would be interesting to know under exactly what conditions it works or fails. I haven't played with the API enough to know it well myself, obviously

@timrae
Copy link
Member

timrae commented Nov 12, 2018 via email

@vi
Copy link
Author

vi commented Nov 12, 2018

Then why "Enable API" checkbox in AnkiDroid settings still changed behaviour a bit (delay vs no delay when returning null)?

@timrae
Copy link
Member

timrae commented Nov 13, 2018

Yeah, no idea... In any case it seems clear that it's a bug in the OS somewhere, not much anyone can do without a reliable reproduction case.

@timrae timrae closed this as completed Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Author Reply Waiting for a reply from the original author
Projects
None yet
Development

No branches or pull requests

3 participants