leolin310148 / ShortcutBadger

An Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers.
Other
7.35k stars 1.34k forks source link

The Samsung(android 9) can't Work #348

Open ljzyljc opened 4 years ago

ljzyljc commented 4 years ago

Hi,My debug Apk can show the number on The Samsung SM-G9600/DS ,but the release Apk can't show the number,and I test the debug and release APK on HUAWEI Device,they all works。I test other Samsung phone(all is android9),they all can't work, So How to slove the Problem?

ljzyljc commented 4 years ago

@Leo-Lin

GaryOS5 commented 4 years ago

Having the same issue where no notifications are showing up on the latest versions of Android (tested 2 devices myself) Whereas it still works on iOS (tested).

Is any effort being made to enable this to once again be compatible with android devices? It worked great but sucks for it to lose support.

ardourk commented 4 years ago

same issue happen to me.. i found it's tiny bugs in shortbudger project i succeeded in android 9 (samsung) finally.

follow as below step

1.open BadgeIntentService.java in me.leolin.shortcutbadger.example

  1. fill some text like this ---> setContentTitle("hello")

    setContentTitle("") make no notification in badge count setContentTitle("some title") make good notification in badge count


    @Override protected void onHandleIntent(Intent intent) { if (intent != null) { int badgeCount = intent.getIntExtra("badgeCount", 0);

        mNotificationManager.cancel(notificationId);
        notificationId++;
    
        Notification.Builder builder = new Notification.Builder(getApplicationContext())
            .setContentTitle("hello") <--------here!!!
            .setContentText("")
            .setSmallIcon(R.drawable.ic_launcher);
    
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            setupNotificationChannel();
    
            builder.setChannelId(NOTIFICATION_CHANNEL);
        }
    
        Notification notification = builder.build();
        ShortcutBadger.applyNotification(getApplicationContext(), notification, badgeCount);
        mNotificationManager.notify(notificationId, notification);
    }

    }