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

Background fetch API not working on Android. #35

Closed
takeyamakenta opened this issue Aug 15, 2023 · 1 comment · Fixed by #38
Closed

Background fetch API not working on Android. #35

takeyamakenta opened this issue Aug 15, 2023 · 1 comment · Fixed by #38
Assignees
Labels
bug Something isn't working

Comments

@takeyamakenta
Copy link

Hello, I have tried fetch API from background JS script. but not working.

addEventListener("fetchTest", async (resolve, reject, args) =>{
    try {
        console.log('fetch start');
        const response  = await fetch('https://jsonplaceholder.typicode.com/todos/1');
        if(response.ok){
            console.log('fetch success');
        }else{
            console.log('fetch failed');
        }
        resolve();
    } catch (error){
        console.log('error caught');
        console.error(error);
        reject();
    }
});
BackgroundRunner.dispatchEvent({
  label: 'com.example.background.task',
  event: 'fetchTest',
  details: {},
});

I have tried this on Android Studio emulator (Android ver 13) but only the messages 'fetch start' and 'error caught' appears on logcat.
Thanks!

@Burzo
Copy link

Burzo commented Sep 16, 2023

Hey @theproducer thank you for looking into this. When can we expect a new version with the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants