Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Support android shortcut badges on supported devices when app is closed #703

Closed
wants to merge 6 commits into from

Conversation

yossale
Copy link

@yossale yossale commented Mar 14, 2016

Update android shortcut badge even when app is closed (on supported devices - HTC, LG, Samsung)

Description

Adding android shortcut badges support. Similarly to the cordova-plugin-badge behaviour, only it works even when the app is closed, and updated from the Java, not the js.

Related Issue

"Notification" Event Not Firing When Closed Through App Launcher
Android badge count

Motivation and Context

Most major Android Launchers now support badges, which are a useful way to keep users engaged with one's app, specially when users are not visiting it too often. However, in the current situation, badges are only updated when the app is either in the foreground/background, which is usually not the case (Specially if your app is a "twice a week kind" of app)

How Has This Been Tested?

It has been tested on Samsung galaxy S5, HTC X9, and One Plus (which doesnt support badges, we tested to make sure nothing breaks in that case)

Screenshots (if appropriate):

Types of changes

  • [X ] Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • [] I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • [] I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -23,7 +23,7 @@
<engines>
<engine name="cordova" version=">=3.6.3" />
<engine name="cordova-android" version=">=4.0.0" />
<engine name="cordova-ios" version=">=4.0.0" />
<engine name="cordova-ios" version=">=3.9.2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, for version 1.6.0 and greater of this plugin we'll only support cordova-ios 4.0.0 or greater. Please revert line.

@macdonst
Copy link
Member

@yossale looks good but please make the required changes and squash your commits.

@macdonst macdonst added this to the Release 1.7.0 milestone Mar 14, 2016
@barryvdh
Copy link
Contributor

PR #624 offers similar functionality, but also supports updating the badge from the javascript app itself.

@@ -191,16 +192,32 @@ private Bundle normalizeExtras(Bundle extras) {
return newExtras;
}

private void updateBadge(Context context, String badge) {

int count = badge == null ? 0 : Integer.parseInt(badge);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would make it impossible to keep the badge count unchanged (eg. when it's not set)

@ejazdragonflycreation
Copy link

after install remove Phone-gap and add Silo-co , when push notification comming. the runtime error generates and app close on android

@macdonst
Copy link
Member

@yossale not going to merge as it is superceeded by #624 but the functionality will be coming in 1.7.0.

@macdonst macdonst closed this Apr 12, 2016
@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants