capacitor-plugin-app-tracking-transparency icon indicating copy to clipboard operation
capacitor-plugin-app-tracking-transparency copied to clipboard

Before clicking on "Allow" or "Don't Allow," it's giving the status, but after clicking on any option, it's not receiving the status.

Open vipinsaini0 opened this issue 9 months ago • 12 comments

          Please check this repo-  https://github.com/vipinsaini0/app-tracking-transparency

@mahnuh I'm still facing the same issue. Before clicking on "Allow" or "Don't Allow," it's giving the status, but after clicking on any option, it's not receiving the status.

Screenshot 2024-05-08 at 10 00 30 AM

Originally posted by @vipinsaini0 in https://github.com/mahnuh/capacitor-plugin-app-tracking-transparency/issues/18#issuecomment-2099794842

vipinsaini0 avatar May 09 '24 07:05 vipinsaini0

@mahnuh Exactly the same issue I faced yesterday. Initially requestPermission method return status 'denied' before choosing one of the options Allow/Ask App Not to Track, but even after choosing it doesn't return status

altaidyn00 avatar May 09 '24 10:05 altaidyn00

@mahnuh Exactly the same issue I faced yesterday. Initially requestPermission method return status 'denied' before choosing one of the options Allow/Ask App Not to Track, but even after choosing it doesn't return status

yes right @altaidyn00

vipinsaini0 avatar May 09 '24 11:05 vipinsaini0

@mahnuh can you please check this issue on priority as I'm stuck duo to Apple AppTrackingTransparency without it app will be reject(attached Repo — #https://github.com/vipinsaini0/app-tracking-transparency)

vipinsaini0 avatar May 10 '24 04:05 vipinsaini0

@vipinsaini0 sorry, I'm maintaining this free plugin in my spare time and paying the bills takes priority for me. It looks like it is working fine for me and a lot of other people. @altaidyn00 can you provide a repo as well? I can try to have a look sometime next week I guess.

mahnuh avatar May 10 '24 05:05 mahnuh

okay

vipinsaini0 avatar May 10 '24 05:05 vipinsaini0

Can you provide a link to the fork please? As I said I will try to have a look sometime next werk.

mahnuh avatar May 10 '24 09:05 mahnuh

Had some time this evening and had a look. The fix you proposed from the other repo did not work. However I was able to fix it and just published a pre-release to npm. Can you please verify that this solves the issue for you @vipinsaini0 @altaidyn00? Just install capacitor-plugin-app-tracking-transparency@next. If it works for you I'll merge and publish it.

mahnuh avatar May 10 '24 22:05 mahnuh

@mahnuh I have the same problem and tested capacitor-plugin-app-tracking-transparency@next, but the issue stays the same. The response of await AppTrackingTransparency.requestPermission() is not awaited, the Promise is resolved to early ...

I'm currently using Capacitor 6.1.0 on iOS 17.5.1.

thoechtl avatar Aug 27 '24 15:08 thoechtl

@mahnuh I further investigated the issue and found a hint: https://stackoverflow.com/a/69373506/7558802 I fixed the issue by adding a timeout before calling AppTrackingTransparency.requestPermission(), although I'm also awaiting the platform.ready() event before. Seems like a timing issue related to applicationDidBecomeActive ...

thoechtl avatar Aug 27 '24 16:08 thoechtl

Hi @thoechtl, can you please provide a repo where I can reproduce this issue? Also please check out this demo project and verify if things are working fine there. For me they are.

mahnuh avatar Aug 27 '24 17:08 mahnuh

The fix from @next already has been released with v2.0.5.

mahnuh avatar Aug 27 '24 17:08 mahnuh

Hi @mahnuh, a demo repo to reproduce the issue can be found here: https://github.com/thoechtl/capacitor-plugin-app-tracking-transparency-demo-app

The issue exists if you request tracking permission right after geolocation permission:

const geoResponse = aawait Geolocation.requestPermissions({ permissions: ['location'] });
...
const response = await AppTrackingTransparency.requestPermission();

But there are two simple workarounds: make a small timeout between the request or just change order ...

Thanks for this useful plugin :-)

thoechtl avatar Aug 27 '24 21:08 thoechtl