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

Deprecation in Android 11 stops the plugin from working #197

Closed
andrlange opened this issue Mar 5, 2021 · 13 comments
Closed

Deprecation in Android 11 stops the plugin from working #197

andrlange opened this issue Mar 5, 2021 · 13 comments
Labels
wontfix This will not be worked on

Comments

@andrlange
Copy link

Due to the deprecation of AsyncTask on Android 11 the plugin is not working anymore

[deprecation] Registrar in PluginRegistry has been deprecated
[deprecation] AsyncTask()
[deprecation] executeOnExecutor
[deprecation] doInBackground
[deprecation] onPostExecute(Result)

@ghenry
Copy link

ghenry commented Mar 22, 2021

Same #196

@arjenfvellinga
Copy link

and #204 I think

@lukasgit
Copy link
Owner

@andrlange @ghenry my plate is full at the moment... can one of you submit a PR for this issue?

@ghenry
Copy link

ghenry commented Apr 1, 2021

@ghenry
Copy link

ghenry commented Apr 1, 2021

Due to the deprecation of AsyncTask on Android 11 the plugin is not working anymore

[deprecation] Registrar in PluginRegistry has been deprecated
[deprecation] AsyncTask()
[deprecation] executeOnExecutor
[deprecation] doInBackground
[deprecation] onPostExecute(Result)

@andrlange which bits aren't working for you? I still see all contacts but can't use these:

ContactsService.openContactForm()
ContactsService..openDeviceContactPicker()

but I they are not related to GetContactsTask or GetAvatarsTask which use AsyncTask

@andrlange
Copy link
Author

By switching on debug logging I even can't get the app build for Android anymore.

I would recommend to transform the Android Java part to Kotlin so Kotlin Coroutines would replace Java Async Tasks. Most of the code should be translated quite simple because it's most work is mapping.

@lukasgit
Copy link
Owner

lukasgit commented Apr 8, 2021

@Faiyyazauxy could you look into this?

@Faiyyazauxy
Copy link
Contributor

Faiyyazauxy commented Apr 10, 2021

Okay i will try to convert it and if done i will create a PR.

Also as i can see the issue in the contact picker flow only. The contact list seems to work fine for android 11.

Tested on pixel 4a.

Update on the above

Hey guys, the issue is not related to asynctask. Yeah I know asynctask has been deprecated and we should move out of it but the core issue is with regard to privacy updates in android 11 for certain requirements.

The contact add & edit falls into such categories. So there is a new requirement where we need to write a tag in manifest mentioning the permission for such special permission. Check out this link for more explaination : https://developer.android.com/training/package-visibility/use-cases

Also check my staging PR, I have added the required tags and it is working fine for now. Asynctask conversion is a big task and right now even I am little busy with something. I will try to convert it if possible because we need to make it from start direct conversion will not work here.

@jasonkaruza
Copy link

Any updates on fixing this? App keeps crashing when trying to get contacts from device.

@lukasgit
Copy link
Owner

@Faiyyazauxy thanks for the update, which staging PR are you referring to?

@ghenry
Copy link

ghenry commented May 12, 2021

The contact add & edit falls into such categories. So there is a new requirement where we need to write a tag in manifest mentioning the permission for such special permission. Check out this link for more explaination : https://developer.android.com/training/package-visibility/use-cases

What are the manifest queries for contacts?

I recently had to do this:

    <!-- AppAuth and url_launcher targeting API 30 or new (Android 11 or newer) -->
    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.APP_BROWSER" />
            <data android:scheme="https" />
        </intent>
        <!-- url_launcher only -->
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="mailto" />
        </intent>
    </queries>

but presume the native code needs updating to check for these too as per https://developer.android.com/training/package-visibility/use-cases

@ghenry
Copy link

ghenry commented Jun 5, 2021

Going to test this now as I see there is a new release (0.6.1)

@stale
Copy link

stale bot commented Aug 4, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 4, 2021
@stale stale bot closed this as completed Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

6 participants