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

Added READ_CONTACTS permission to be able to access accounts #351

Closed
wants to merge 1 commit into from

Conversation

regnete
Copy link

@regnete regnete commented Aug 24, 2020

fixes #350

@@ -36,8 +36,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.ArrayList;
import java.util.List;

import static android.Manifest.permission.GET_ACCOUNTS;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.*;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that versed in Android Java, but it is wise to import .*?

@jfoclpf
Copy link
Collaborator

jfoclpf commented Nov 22, 2021

I will test your PR in Android 9 and 11 with

cordova plugin add github:katzer/cordova-plugin-email-composer#pull/351/head

I suppose this does work (saw here)

@@ -202,7 +203,16 @@ cordova.plugins.email.requestPermission(permission, callbackFn);
```

__Note:__ The author of the app has to make sure that the permission is listed in the manifest.

For __Android__ you may add the following lines to config.xml to achieve this:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is breaking the build when I insert this in config.xml, did you mean edit-config instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> Task :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource compilation failed
     /home/joao/dev/form-for-parking-violation/platforms/android/app/src/main/res/xml/config.xml:97: AAPT: error: unbound prefix.
         
     /home/joao/dev/form-for-parking-violation/platforms/android/app/src/main/res/xml/config.xml: AAPT: error: file failed to compile.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could make it work, it was missing xmlns:android="http://schemas.android.com/apk/res/android" at the widget root of config.xml

@jfoclpf
Copy link
Collaborator

jfoclpf commented Nov 22, 2021

@regnete I used your PR and still when I run cordova.plugins.email.hasAccount((res)=> console.log(res)) I get false. Tested with Xioami Redmi Android 11.

Furthermore it crashes while opening Email App with Android 11

If it doesn't work, we cannot merge it, sorry

@jfoclpf jfoclpf closed this Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cordova.plugins.email.hasAccount always returns false on Android 10
2 participants