GithubHelp home page GithubHelp logo

g123k / flutter_app_badger Goto Github PK

View Code? Open in Web Editor NEW
294.0 8.0 128.0 200 KB

Support to update the app badge on the launcher (both for Android and iOS)

Home Page: https://pub.dev/packages/flutter_app_badger

License: Apache License 2.0

Java 15.18% Ruby 26.06% Objective-C 32.03% Dart 26.73%
flutter badge ios launcher android dart dartlang

flutter_app_badger's Introduction

Flutter App Badger plugin

Pub

This plugin for Flutter adds the ability to change the badge of the app in the launcher. It supports iOS, macOS, and some Android devices (the official API does not support the feature, even on Oreo).

Android badge

Android badge

Getting Started

iOS

On iOS, the notification permission is required to update the badge. It is automatically asked when the badge is added or removed.

Please also add the following to your /ios/Runner/Info.plist:

<key>UIBackgroundModes</key>
    <array>
        <string>remote-notification</string>
    </array>

macOS

On macOS, the notification permission is required to update the badge. It is automatically asked when the badge is added or removed.

Please also add the following to your /macos/Runner/Info.plist:

<key>NSUserNotificationAlertStyle</key>
<string>banner</string>

Android

On Android, no official API exists to show a badge in the launcher. But some devices (Samsung, HTC...) support the feature. Thanks to the Shortcut Badger library, ~ 16 launchers are supported.

Dart

First, you just have to import the package in your dart files with:

import 'package:flutter_app_badger/flutter_app_badger.dart';

Then you can add a badge:

FlutterAppBadger.updateBadgeCount(1);

Remove a badge:

FlutterAppBadger.removeBadge();

Or just check if the device supports this feature with:

FlutterAppBadger.isAppBadgeSupported();

flutter_app_badger's People

Contributors

ariejan avatar atrope avatar bannzai avatar edward-yakop avatar f-person avatar fzyzcjy avatar g-30 avatar g123k avatar johnmartel avatar mathiascochet avatar riscait avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_app_badger's Issues

Badges disappear when App went to the background and open again

I have used firebase_messaging for push notification. And I used flutter_app_badger for manually set badge to the launcher icon. Everything work fine until I close the app to foreground and open app again, the badge is just gone.

So how to have the badge stay? Is there some thing to do with firebase_messaging instead ?

Here how I update the badge

FlutterAppBadger.updateBadgeCount(badgeNum);

Badge counter seems not supported for this platform: unable to resolve intent: Intent { act=android.intent.action.BADGE_COUNT_UPDATE (has extras) }

I/ShortcutBadger(28452): Checking if platform supports badge counters, attempt 1/3.
I/ShortcutBadger(28452): Checking if platform supports badge counters, attempt 2/3.
I/ShortcutBadger(28452): Checking if platform supports badge counters, attempt 3/3.
Badge counter seems not supported for this platform: unable to resolve intent: Intent { act=android.intent.action.BADGE_COUNT_UPDATE (has extras) }

flutter_app_badger Not working on android devices. Is there anything more I have to do ?

I did following on pubspec.yaml: flutter_app_badger: ^1.1.2,
, put the example code shown in the guide (pub.dev) into main.dart
and I run the project on device (Samsung Note 9).

It shows "FlutterAppBadger.isAppBadgeSupported() : true => supported",
but Badge is not appeared on the ICON through FlutterAppBadger.updateBadgeCount(1).

SdkVersion is now in build.gradle
minSdkVersion 29
targetSdkVersion 29

I didn't do anything else except applying the example code in Readme , Badge is not shown on the ICON.

I'm not able to display the counter on ios

Good Morning

Guys, I'm finding it difficult to make flutter_app_badger work on ios, on android it's working perfectly for devices that have support but not on ios.

The goal is that when receiving a notification sent from firebase in the background or with the app closed, the counter is incremented as the notifications arrive.

I checked the documentation and from what I understand it is enough that the info.plist file has the parameter below:

UIBackgroundModes

remote-notification

I have already performed the configuration above and even so I receive the notifications but the icon change does not occur.

I'm using flutter 2.5.3 and using an iphone whose ios version is 15.0.2

Doing a debug I couldn't detect any kind of error it just doesn't happen what I expect, I did another test a little different and if the application is in the foreground I put it to FlutterAppBadger.updateBadgeCount(3) for example the update happens but when the app is. in the background this doesn't happen is there any more configuration needed on the ios part?

Error when build release

I get this error when try to build release version for android with comman flutter build apk --release:

* What went wrong:                                                      
Execution failed for task ':app:lintVitalRelease'.                      
> Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not resolve com.google.android.gms:play-services-base:[15.0.0,16.0.0).
     Required by:                                                       
         project :app > com.google.android.gms:play-services-cast-framework:15.0.0
         project :app > com.google.android.gms:play-services-cast:15.0.0
      > Failed to list versions for com.google.android.gms:play-services-base.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-base/'.
               > Could not GET 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-base/'. Received status code 400 from server: Bad Request
   > Could not resolve com.google.android.gms:play-services-basement:[15.0.0,16.0.0).
     Required by:                                                       
         project :app > com.google.android.gms:play-services-cast-framework:15.0.0
         project :app > com.google.android.gms:play-services-cast:15.0.0
      > Failed to list versions for com.google.android.gms:play-services-basement.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-basement/'.
               > Could not GET 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-basement/'. Received status code 400 from server: Bad Request
   > Could not resolve com.google.android.gms:play-services-tasks:[15.0.0,16.0.0).
     Required by:                                                       
         project :app > com.google.android.gms:play-services-cast:15.0.0
      > Failed to list versions for com.google.android.gms:play-services-tasks.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-tasks/'.
               > Could not GET 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-tasks/'. Received status code 400 from server: Bad Request
   > Could not resolve com.google.android.gms:play-services-base:[15.0.1].
     Required by:                                                       
         project :app > com.google.android.gms:play-services-flags:15.0.1
      > Failed to list versions for com.google.android.gms:play-services-base.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-base/'.
               > Could not GET 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-base/'. Received status code 400 from server: Bad Request
   > Could not resolve com.google.android.gms:play-services-basement:[15.0.1].
     Required by:                                                       
         project :app > com.google.android.gms:play-services-flags:15.0.1
      > Failed to list versions for com.google.android.gms:play-services-basement.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-basement/'.
               > Could not GET 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-basement/'. Received status code 400 from server: Bad Request

Show badge with closed app

I'm using your plugin, it works correctly on iOS but only if I get the push notifications with the app open, do you have any solution for when I get with the app closed?

I'm using Firebase for push notification.

`flutter_app_badger` uses or overrides a deprecated API (Android)

Description

This library uses or overrides a deprecated API on Android. You can reproduce it by doing the following steps:

  1. Clone example
  2. Run flutter run

Logs

Note: /Users/nils/Desktop/Projekte/flutter_app_badger/android/src/main/java/fr/g123k/flutterappbadger/FlutterAppBadgerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.                    
Note: Some input files use or override a deprecated API.                
Note: Recompile with -Xlint:deprecation for details.     

Migrate example to Android embedding v2

Description

The example of this package isn't migrated to Android embedding v2 yet.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project.

Steps to reproduce

  1. Open example
  2. Run flutter pub get

The plugin `flutter_app_badger` uses a deprecated version of the Android embedding.

AndroidStudio/Flutter shows this warning.

The plugin flutter_app_badger uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Show current Badge Number

It would be great that the plugin could get the current badge number. Same method for set the current number, but fot get the number.

Thanks.

build release apk error

I use flutter_app_badger: ^1.1.2.
I got this error when I build release apk:

FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'assembleAarRelease' not found in root project 'flutter_app_badger'.

  • Try:
    Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s

The plugin flutter_app_badger could not be built due to the issue above.

not supported in android devices.

I implemented in my project works fine in iOS devices but in android devices badge on app icon not supported also try demo example in some vivo and Mi devices but shows message as mention in demo example: appBadgeSupported = 'Not supported'. it's working on in iOS only...

A problem occurred configuring root project 'flutter_app_badger'

Hi
when I try to use flutter_app_badger I face this issue.
how can I solve this ?

Could not resolve all artifacts for configuration ':classpath'.

Could not find gradle.jar (com.android.tools.build:gradle:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.jar
Could not find builder.jar (com.android.tools.build:builder:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.2/builder-3.5.2.jar
Could not find crash.jar (com.android.tools.analytics-library:crash:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.5.2/crash-26.5.2.jar
Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.5.2/lint-gradle-api-26.5.2.jar
Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.5.2/gradle-api-3.5.2.jar
Could not find databinding-compiler-common.jar (androidx.databinding:databinding-compiler-common:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.5.2/databinding-compiler-common-3.5.2.jar
Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.5.2/manifest-merger-26.5.2.jar
Could not find sdk-common.jar (com.android.tools:sdk-common:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.5.2/sdk-common-26.5.2.jar
Could not find builder-test-api.jar (com.android.tools.build:builder-test-api:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.5.2/builder-test-api-3.5.2.jar
Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.5.2/ddmlib-26.5.2.jar
Could not find tracker.jar (com.android.tools.analytics-library:tracker:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.5.2/tracker-26.5.2.jar
Could not find sdklib.jar (com.android.tools:sdklib:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.5.2/sdklib-26.5.2.jar
Could not find layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.5.2/layoutlib-api-26.5.2.jar
Could not find dvlib.jar (com.android.tools:dvlib:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.5.2/dvlib-26.5.2.jar
Could not find repository.jar (com.android.tools:repository:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.5.2/repository-26.5.2.jar
Could not find shared.jar (com.android.tools.analytics-library:shared:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.5.2/shared-26.5.2.jar
Could not find common.jar (com.android.tools:common:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/common/26.5.2/common-26.5.2.jar
Could not find protos.jar (com.android.tools.analytics-library:protos:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.5.2/protos-26.5.2.jar
Could not find builder-model.jar (com.android.tools.build:builder-model:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.5.2/builder-model-3.5.2.jar
Could not find apkzlib.jar (com.android.tools.build:apkzlib:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.5.2/apkzlib-3.5.2.jar
Could not find apksig.jar (com.android.tools.build:apksig:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.5.2/apksig-3.5.2.jar
Could not find annotations.jar (com.android.tools:annotations:26.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.5.2/annotations-26.5.2.jar
Could not find databinding-common.jar (androidx.databinding:databinding-common:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/3.5.2/databinding-common-3.5.2.jar
Could not find baseLibrary.jar (com.android.databinding:baseLibrary:3.5.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.5.2/baseLibrary-3.5.2.jar

flutter badger doesn't work

The flutter badger user to work on my phone. But after months it does'nt work at all in both ios and android. I even created a new project and put the standard code, but still not work

C:\Users\simo\IdeaProjects\test_badger>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [version 10.0.19042.1237], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Community Edition (version 2020.1)
[√] VS Code (version 1.61.0)
[√] Connected device (3 available)

• No issues found!

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app_badger/flutter_app_badger.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _appBadgeSupported = 'Unknown';

  @override
  initState() {
    super.initState();
    initPlatformState();
  }

  initPlatformState() async {
    String appBadgeSupported;
    try {
      bool res = await FlutterAppBadger.isAppBadgeSupported();
      if (res) {
        appBadgeSupported = 'Supported';
      } else {
        appBadgeSupported = 'Not supported';
      }
    } on PlatformException {
      appBadgeSupported = 'Failed to get badge support.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _appBadgeSupported = appBadgeSupported;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new SizedBox.expand(
          child: new Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              new Text('Badge supported: $_appBadgeSupported\n'),
              new RaisedButton(
                child: new Text('Add badge'),
                onPressed: () {
                  _addBadge();
                },
              ),
              new RaisedButton(
                  child: new Text('Remove badge'),
                  onPressed: () {
                    _removeBadge();
                  }),
            ],
          ),
        ),
      ),
    );
  }

  void _addBadge() {
    FlutterAppBadger.updateBadgeCount(1);
  }

  void _removeBadge() {
    FlutterAppBadger.removeBadge();
  }
}

Unhandled Exception: MissingPluginException(No implementation found for method updateBadgeCount on channel flutter_app_badger)

I integrate the plugin but when I run the code, I am getting following error.

E/flutter (14767): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method updateBadgeCount on channel app_badge)
E/flutter (14767): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)
E/flutter (14767):
E/flutter (14767): #1 FlutterAppBadger.updateBadgeCount (package:flutter_app_badger/flutter_app_badger.dart:12:14)
E/flutter (14767): #2 _BottomNavBarAppState.calculateCounter.. (package:smartmd/bottomNavigation/BottomNavBarApp.dart:271:26)
E/flutter (14767): #3 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter (14767): #4 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (14767): #5 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter (14767): #6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter (14767): #7 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter (14767): #8 Future._complete (dart:async/future_impl.dart:473:7)
E/flutter (14767): #9 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter (14767): #10 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:28:18)
E/flutter (14767): #11 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:294:13)

Can I use this package to remove the notification badges/dots introduced in Android 8.0 (Oreo)?

As mentioned in the title, can I use flutter_app_badger to set or remove the notification badge/dot shown on Android devices running Oreo(Android Version 8.0) and above. These notification dots do not have a number but are shown in the launcher on the app icon if the app has active notifications.

To be more specific I'm talking about these Notification badges/dots: https://developer.android.com/guide/topics/ui/notifiers/notifications.html#icon-badge

Thanks.

change badge count in background

how to change badge count when app is in background. for example, when i receive push notification, i have to increase the badge count

Exception in FlutterAppBadgerPlugin.m

While the Plugin works well on our test devices (were not able to reproduce locally), some reports in the Apple Appstore suggest, that the Badger Plugin can crash unter certain circumstances:

Release Type:        User
Baseband Version:    2.05.01

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                	0x1844dd754 __exceptionPreprocess + 220 (NSException.m:199)
1   libobjc.A.dylib               	0x198fa47a8 objc_exception_throw + 60 (objc-exception.mm:565)
2   CoreFoundation                	0x1843e0c3c -[NSObject(NSObject) doesNotRecognizeSelector:] + 144 (NSObject.m:146)
3   CoreFoundation                	0x1844e02ac ___forwarding___ + 1444 (NSForwarding.m:3651)
4   CoreFoundation                	0x1844e25b0 _CF_forwarding_prep_0 + 96
5   flutter_app_badger            	0x10479f0d8 -[FlutterAppBadgerPlugin handleMethodCall:result:] + 216 (FlutterAppBadgerPlugin.m:24)
6   Flutter                       	0x10511ce60 0x104b5c000 + 6032992
7   Flutter                       	0x104b940d8 0x104b5c000 + 229592
8   Flutter                       	0x104e90f8c 0x104b5c000 + 3362700
9   Flutter                       	0x104e31d94 0x104b5c000 + 2973076
10  Flutter                       	0x104e33bf4 0x104b5c000 + 2980852
11  CoreFoundation                	0x18445822c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1807)
12  CoreFoundation                	0x184457e28 __CFRunLoopDoTimer + 1076 (CFRunLoop.c:2415)
13  CoreFoundation                	0x184457278 __CFRunLoopDoTimers + 328 (CFRunLoop.c:2575)
14  CoreFoundation                	0x18445102c __CFRunLoopRun + 1944 (CFRunLoop.c:3090)
15  CoreFoundation                	0x184450360 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
16  GraphicsServices              	0x19ba8e734 0x19ba8b000 + 14132
17  UIKitCore                     	0x186ecb584 -[UIApplication _run] + 1072 (UIApplication.m:3269)
18  UIKitCore                     	0x186ed0df4 UIApplicationMain + 168 (UIApplication.m:4740)
19  CORE smartwork                	0x104335884 0x104330000 + 22660
20  libdyld.dylib                 	0x18410ccf8 start + 4

This is where the count itself is getting updated:

FlutterAppBadgerPlugin.m:24
[UIApplication sharedApplication].applicationIconBadgeNumber = count.integerValue;

Please update your Read Me file

The Read Me file says that you can import the plugin using:

import 'package:flutterappbadger/flutterappbadger.dart';

When actually the correct import statement is:

import 'package:flutter_app_badger/flutter_app_badger.dart';

Flutter app badger import error

import 'package:flutter_app_badger/flutter_app_badger.dart';

This line throws the below error.

Target of URI doesn't exist: 'package:flutter_app_badger/flutter_app_badger.dart'.
Try creating the file referenced by the URI, or Try using a URI for a file that does exist.dart(uri_does_not_exist)

I have already get packages and the problem still persist.

Plugin not compatible with latest flutter version (Android Embedding)

The plugin flutter_app_badger uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise,
consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding:
https://flutter.dev/go/android-plugin-migration.

App Crashed

After adding the package the app get crashed

Does not work in background mode android on background message function

I tried it in background message like this but throws errors {Unhandled Exception: MissingPluginException(No implementation found for method updateBadgeCount on channel g123k/flutter_app_badger)}

Future myBackgroundMessageHandler(Map<String, dynamic> message) async {
FlutterAppBadger.updateBadgeCount(1);
}

But works perfectly in here. Gives problem only in background message function

Widget build(BuildContext context) {
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
FlutterAppBadger.updateBadgeCount(1);
},);
}

import which dart package?

import 'package:flutter_app_badger/flutter_app_badger.dart';
or
import 'package:flutterappbadger/flutterappbadger.dart';

Unable updateBadgeCount in OnBackgroundMessage

Hi
I'm adopting the latest version 1.1.2. It works in normal implementation on my Android device. But if I add the code into FCM onBackgroundMessage, it generate the error "MissingPluginException(No implementation found for method updateBadgeCount on channel g123k/flutter_app_badger)".

This is different with the issue #13 "#13"
I still try the issue #13 is recommended to do "flutter clean", "flutter pub get", of course, not help.

My error is about the plugin is not registered in Android due to the onBackgroundMessage is an isolate code, not depend on the base app. So, I believe there is something should be registered in Application.java. For example, for access SharedPreferences in onBackgroundMessage, we need to add SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")); but I have no idea for app_badge, what should be registerWith? Could you help?

Not able to make it work

I could able to install this package but not able to run/build Android app.
pubspec.yaml

cupertino_icons: ^0.1.2
  cloud_firestore: ^0.12.11
  firebase_auth:
    git:
      url: https://github.com/collinjackson/plugins.git
      ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
      path: packages/firebase_auth
  flutter_form_builder: ^3.4.0
  flutter_cupertino_date_picker: ^1.0.11
  image_picker: ^0.6.1+4
  firebase_database: ^3.1.0
  firebase_storage: ^3.0.10
  dio: ^2.1.16
  path_provider: ^1.2.0
  open_file: ^2.0.3
  http: ^0.12.0+1
  random_string: ^1.1.0
  network_to_file_image: ^2.0.6
  country_pickers: ^1.1.0
  video_player: ^0.10.2+5
  super_tooltip: ^0.9.0
  flutter_chips_input: ^1.6.1
  intl_phone_number_input: ^0.1.1
  libphonenumber: ^1.0.0
  flutter_plugin_pdf_viewer: ^1.0.7
  time_machine: ^0.9.8
  pin_input_text_field: ^2.0.0
  url_launcher: ^5.1.2
  mime_type: ^0.2.4
  image_cropper: ^1.1.0
  get_it: ^1.0.3+2
  liquid_swipe: ^1.1.0
  modal_progress_hud: ^0.1.3
  flutter_secure_storage: ^3.2.1+1
  flutter_launcher_icons: ^0.7.3
  dots_indicator: ^1.0.0
  grouped_buttons: ^1.0.4
  fluttertoast : ^3.1.0
  bubble: ^1.1.9+1
  circular_custom_loader: ^1.0.6
  file_picker: ^1.3.3
  flutter_offline: ^0.2.4
  async: ^2.3.0
  dragablegridview_flutter: ^0.2.5
  intl: ^0.15.8
  flutter_datetime_picker: ^1.2.8
  timeago: ^2.0.19
  md2_tab_indicator: ^1.0.2
  flutter_parsed_text: ^1.1.0
  uuid: ^2.0.1
  transparent_image: ^1.0.0
  flutter_sound: ^1.4.8
  chewie: ^0.9.8+1
  audioplayers: ^0.13.0
  flutter_document_picker: ^3.0.0
  permission_handler: ^3.2.2
  share: ^0.6.2+4
  onesignal_flutter: ^2.0.0
  flutter_app_badger: ^1.1.1
  badges: ^1.1.0
  bubble_bottom_bar: ^1.2.0
  flutter_native_splash: ^0.1.9 
  flutter_statusbar_manager: ^1.0.2
  keyboard_avoider: ^0.1.2
  connectivity: 0.4.4+1
  cool_ui: ^0.3.1

Error I'm getting

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.google.android.gms:play-services-ads-identifier:[15.0.0, 16.0.99].
     Required by:
         project :app > com.onesignal:OneSignal:3.12.3
      > Failed to list versions for com.google.android.gms:play-services-ads-identifier.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-ads-identifier/'.
               > Could not GET 'https://raw.githubusercontent.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-ads-identifier/'. Received status code 400 from server: Bad Request
   > Could not resolve com.google.firebase:firebase-iid:[18.0.0].
     Required by:
         project :app > com.google.firebase:firebase-messaging:18.0.0
      > Failed to list versions for com.google.firebase:firebase-iid.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/firebase/firebase-iid/'.
               > Could not GET 'https://raw.githubusercontent.com/g123k/ShortcutBadger/master/com/google/firebase/firebase-iid/'. Received status code 400 from server: Bad Request
   > Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
     Required by:
         project :app > com.google.android.gms:play-services-location:15.0.1
         project :app > com.google.android.gms:play-services-places-placereport:15.0.1
      > Failed to list versions for com.google.android.gms:play-services-basement.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-basement/'.
               > Could not GET 'https://raw.githubusercontent.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-basement/'. Received status code 400 from server: Bad Request
   > Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
     Required by:
         project :app > com.google.android.gms:play-services-location:15.0.1
      > Failed to list versions for com.google.android.gms:play-services-tasks.
         > Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
            > Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-tasks/'.
               > Could not GET 'https://raw.githubusercontent.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-tasks/'. Received status code 400 from server: Bad Request

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 59s

If I remove this package, app runs without a single change. Kindly help

Unable to build Android Release APK

Hey, I'm using flutter_app_badger: 1.0.3+2 in my app. Debug builds and runs flawlessly but Gradle crashes when compiling APK for release. Details below.

Logs

➜  qweex git:(master) ✗ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...                                
                                                                
FAILURE: Build failed with an exception.                                                                           
                                                                                                                   
* What went wrong:                                                                                                 
Execution failed for task ':flutter_app_badger:verifyReleaseResources'.                                            
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade                  
   > Android resource linking failed                                                                               
     /Users/musa/.gradle/caches/transforms-2/files-2.1/93d7ae8bc00cd79d08e935d76825e97b/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                                                                   
     /Users/musa/.gradle/caches/transforms-2/files-2.1/93d7ae8bc00cd79d08e935d76825e97b/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
                                                                                                                   
                                                                                                                   
* Try:                                                                                                             
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                                                                   
* Get more help at https://help.gradle.org                                                                         
                                                                                                                   
BUILD FAILED in 6m 14s                                                                                             
Running Gradle task 'assembleRelease'...                                                                           
Running Gradle task 'assembleRelease'... Done                     388.9s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
The plugin cloud_firestore could not be built due to the issue above.   
Running Gradle task 'assembleAarRelease'...                            ⡿%                                                                                 
➜  qweex git:(master)

Flutter Doctor -V

[✓] Flutter (Channel master, v1.10.15-pre.424, on Mac OS X 10.15 19A602, locale
    en-GB)
    • Flutter version 1.10.15-pre.424 at /Applications/Flutter-SDK/flutter
    • Framework revision 289b4588f4 (5 days ago), 2019-11-06 02:51:17 -0500
    • Engine revision 9726b4cb99
    • Dart version 2.7.0

 
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Applications/Android-SDK/
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-29, build-tools 28.0.3
    • ANDROID_HOME = /Applications/Android-SDK/
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.1, Build version 11A1027
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.40.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.6.0

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

Supported?

It seems this package has been over a year since any updates. Anyone know if it's still supported or if there are better options now?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.