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

[BUG] Error on backgroundFetchHeadlessTask #118

Closed
spalenzuela opened this issue May 25, 2020 · 2 comments
Closed

[BUG] Error on backgroundFetchHeadlessTask #118

spalenzuela opened this issue May 25, 2020 · 2 comments

Comments

@spalenzuela
Copy link

Your Environment

  • Plugin version: 0.5.5
  • Platform: Android
  • OS version: 8.0
  • Device manufacturer / model: Samsung S7
  • Flutter info (flutter info, flutter doctor):
    [√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Versión 10.0.18363.592], locale es-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] Proxy Configuration
[√] Connected device (1 available)

• No issues found!

To Reproduce
Steps to reproduce the behavior:

  1. In foreground app send the SMS
  2. In background app send the SMS
  3. After close app, Exception received

backgroundFetchHeadlessTask(String taskId) async {
if (taskId == kNotificationTask) {
await Sendsms.onGetPermission();
if (await Sendsms.hasPermission())
await Sendsms.onSendSMS(number, message);
};
BackgroundFetch.finish(taskId);
}

Debug logs

@spalenzuela spalenzuela changed the title [BUG] [BUG] Error on backgroundFetchHeadlessTask May 25, 2020
@christocracy
Copy link
Member

christocracy commented May 25, 2020

Background Fetch doesn’t involve permissions.

Unhandled Exception: PlatformException(error, Attempt to invoke v
irtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference, null)

FYI plugins can’t request permissions when app is terminated and headless. There’s no user available to respond to permission requests.

Seek support with whatever plugin you’re using that’s causing this crash.

@spalenzuela
Copy link
Author

Thank you

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

No branches or pull requests

2 participants