GithubHelp home page GithubHelp logo

katzer / cordova-plugin-badge Goto Github PK

View Code? Open in Web Editor NEW
408.0 408.0 254.0 56.25 MB

Access and modify badge numbers

License: Apache License 2.0

Java 16.75% Objective-C 28.37% JavaScript 35.39% Objective-C++ 19.49%
badge badge-number cordova-android-plugin cordova-ios-plugin cordova-plugin cordova-plugin-badge

cordova-plugin-badge's People

Contributors

adhipg avatar excendia avatar katzer 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  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

cordova-plugin-badge's Issues

Permission Question Notification - translatable?

I already use the plugin implementation was very easy - thanks for that.

Is it possible to translate the Notification "XXX" Would like to Send you..?
Or is it possible to change the Text?

Maybe Text implimentation whould be nice:

    if (window.cordova) {
        $ionicPlatform.ready(function() {
          console.log("Badge Init");
            $cordovaBadge.promptForPermission();
            //Set Badge for all Services
            $cordovaBadge.hasPermission().then(function(result) {

                //Translatable Notification
                $cordovaBadge.setText($translate.instant('NOTIFICATION TEXT');

                $cordovaBadge.set($rootScope.testCount + $rootScope.testteamCount);
                console.log("Badge Count Set");
            }, function(error) {
                console.log(error);
            });
        });
      }

plugin badge and Meteor, cannot set Badge

Hi!

I cannot set the badge using this package with Meteor. Has anyone used this package with Meteor?.
I tried to set the badge using the console too, but nothing works. I only tested it with my Android 4.0 (Samsung Galaxy R)

I'm using also Meteor package 'raix:push' that uses 'phonegap-plugin-push:1.3.0'. Is there any incompatibility with that plugin?

This is my code:

onBadgeSet = () ->
  console.log 'badge set'
  console.log 'badge get', cordova.plugins.notification.badge.get()
onBadgeRegistration = () ->
  console.log 'badge registration done!'
  cordova.plugins.notification.badge.set('10', onBadgeSet, this)
console.log 'badge get 2', cordova.plugins.notification.badge.get()
cordova.plugins.notification.badge.registerPermission(onBadgeRegistration, this)

I see badge set in the console, but badge get is undefined

I'm not sure I'm using the plugin correctly.
Thank you in advance!

Cannot find module 'cordova-lib/src/cordova/platforms'

Cordova 5.0.0
cordova plugin add de.appplant.cordova.plugin.badge

Fetching plugin "de.appplant.cordova.plugin.badge" via cordova plugins registry
npm http GET http://registry.cordova.io/de.appplant.cordova.plugin.badge
npm http 304 http://registry.cordova.io/de.appplant.cordova.plugin.badge
Installing "de.appplant.cordova.plugin.badge" for ios
Failed to install 'de.appplant.cordova.plugin.badge':Error: Cannot find module 'cordova-lib/src/cordova/platforms'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:48:12)
    at module.exports (/Users/butchewing/Projects/BYP/2015/app/plugins/de.appplant.cordova.plugin.badge/scripts/ios/didRegisterUserNotificationSettings.js:40:29)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:152:18)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:130:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:115:20
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
Error: Cannot find module 'cordova-lib/src/cordova/platforms'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:48:12)
    at module.exports (/Users/butchewing/Projects/BYP/2015/app/plugins/de.appplant.cordova.plugin.badge/scripts/ios/didRegisterUserNotificationSettings.js:40:29)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:152:18)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:130:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:115:20
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)

iOS8 setting badge changes notifications permissions.

I'm using this plugin along with cordova-plugin-local-notifications. Unfortunately as just after i set badge on iOS8, I can no longer schedule notifications:

Attempting to schedule a local notification <UIConcreteLocalNotification: 0x7f8a5b38e340>{fire date = Thursday, March 5, 2015 at 6:00:25 PM Central European Standard Time, time zone = Europe/Warsaw (GMT+1) offset 3600, repeat interval = NSCalendarUnitEra, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = Thursday, March 5, 2015 at 6:00:25 PM Central European Standard Time, user info = {
    autoCancel = 1;
    id = 1;
    json = "";
}} with an alert but haven't received permission from the user to display alerts

Is it a bug or am I doing something wrong?

Edit:

There is a way to set badges just with Locale Notifications by passing only id and badge count (in case somebody has the same problem).

Badges not working in background in iOS

Hello, I'm using the badge plugin 0.5.2 version inside a phonegap build 3.3 application using jQuery mobile 1.4.2.

To keep the application running, I'm using the BackgroundJS plugin, which keeps the app in the background (to make sure it's working I added a popup inside a 5 minutes interval, which I can see after having the application minimized for that much time)

However the window.plugin.notification.badge.set() doesn't seems to be working on background.

If I keep the app open I get the same popups and when I minimize it the application's icon has the badge number correctly applied.

If I minimize the app I never get the badge icon to update, even when I restore it back I get the popups, but when I minimize it back the icon still has no number change inside the badge.

Does the plugin requires the app to be open to upgrade the badges?

PGB limited to version 0.6.4

For some reason the version on PhoneGap Build is stuck on 0.6.4 and isn't updating to 0.7.1. Is this something you can fix?

V 0.6.3 Phonegap Build Error

HI,

i've just got this error while compiling with Phonegap Build on iOS:

The following build commands failed:
CompileC build/xxx.build/Release-iphoneos/xxx.build/Objects-normal/armv7/APPBadge.o xxx/Plugins/de.appplant.cordova.plugin.badge/APPBadge.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Android is fine. I went back to 0.6.2 for now.

Error: WebView.destroy() called while still attached

I used the latest version of example-branch and I will get the error when I click back button to exit the app.
Following info is from logcat:
...
09-18 09:51:33.394 12701-12979/de.appplant.cordova.plugin.badge.example D/TilesManager﹕ Starting TG #0, 0xb9864d00
09-18 09:51:44.204 12701-12701/de.appplant.cordova.plugin.badge.example W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection
09-18 09:51:45.130 12701-12701/de.appplant.cordova.plugin.badge.example E/webview﹕ Error: WebView.destroy() called while still attached!
...

not compatible with the local notification plugin

installing one without the other works perfectly but the two in presence of each other produce below:

** BUILD FAILED **


The following build commands failed:
    Ld build/emulator/demo.app/demo normal i386
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/daniel/demo/platforms/ios/cordova/build-debug.xcconfig,-project,demo.xcodeproj,ARCHS=i386,-target,demo,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/daniel/demo/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/daniel/demo/platforms/ios/build/sharedpch
ERROR building one of the platforms: Error: /Users/daniel/demo/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/daniel/demo/platforms/ios/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I was using the latest version of them with the latest version of ionic.

Plugins namespace

Most (if not all? I didn't check) of the plugins use the window.plugins namespace, this is the only one I noticed that uses window.plugin.
Not a huge problem, but had me puzzling for a bit (I wrote window.plugins out of habit).

Version="0.6.1" not available on PhoneGap Build

I'm experiencing App crashes since developing in iOS8 and now testing on iOS7. Obvious change to config.xml

gap:plugin name="de.appplant.cordova.plugin.badge" version="0.6.1"

But, this version isn't available on the cloud based PhoneGap Build?

Compilation issue With iOS

I am trying to use your plugin inside Phonegap/Cordova generated application. But the problem is it is not compiling when I run the iOS project.

/**

  • Register permission to show badges.
    *

  • @param callback

  •  The function to be exec as the callback
    

    */

    • (void) registerPermission:(CDVInvokedUrlCommand *)command
      {
      if (![[UIApplication sharedApplication]
      respondsToSelector:@selector(registerUserNotificationSettings:)])
      {
      return [self hasPermission:command];
      }

    _command = command;

    [self.commandDelegate runInBackground:^{
    [self.app registerPermissionToDisplayBadges];
    }];
    }

pragma mark -

pragma mark Delegates

/**

  • Called on otification settings registration is completed.
    */
    • (void) didRegisterUserNotificationSettings:(UIUserNotificationSettings*)settings
      {
      if (_command)
      {
      [self hasPermission:_command];
      _command = NULL;
      }
      }

screen shot 2015-05-24 at 1 45 33 pm

iOS 8 badge updates not working

First off, thank you for the great plugin - it worked perfectly under iOS 7.

Under iOS 8 apparently Apple has made API changes and now requires the user grant permission for badge updates. Because of this, this plugin no longer works with iOS 8.

Do you have any plans to update your plugin to properly support iOS 8?

Thanks!

0.7.1 version from npm will cause PGB ios build fail

hi @katzer
I am using PGB cli-5.2.0 + gradle build
for now 0.7.1 version from npm will cause PGB ios build fail and have these error message

Error - The following plugin (or plugin version) is not on npm or not available for this platform:
[email protected]": Fetching plugin "[email protected]" 
via npm Installing "de.appplant.cordova.plugin.badge" for ios Fetching plugin
"de.appplant.cordova.common.registerusernotificationsettings

Badge always clears when tapping app icon

Hi there,

It seems the badge gets cleared everytime I tap the app icon, even though I disabled this using (as stated here):

cordova.plugins.notification.badge.configure({ autoClear: false });

Also the deprecated cordova.plugins.notification.badge.setClearOnTap(false) didn't have any effect.

Plugin version: 0.6.3 and 0.6.4.
iOS 8.3

Am I doing missing something, or is this a known issue? For now I've created a workaround that resets the badge to the last known value on Cordova's resume event.

Android Notifications

Hello everyone!
I have integrated plugin into android phonegap app, it works just fine in terms of sending Android notifications (in status bar), but does not show count on icon badge. I've reread code of plugin trying to find where this functionality is — but didn't find it and now I am wondering, how to make it work & integrate it properly? I may provide any additional information if needed.
Thank you in advance!

Update Threading

I got this warning when setting a badge
THREAD WARNING: exec() call to Badge.setBadge blocked the main thread for 101ms. Plugin should use CordovaInterface.getThreadPool().

Doesn't work in debug?

I am testing this out on iOS using the PhoneGap debug application. After hitting phonegap serve and loading up in the iPhone, I get my "deviceready" event and I trigger an alert just to get a popup of when this event triggers, I then run:

cordova.plugins.notification.badge.set(10);

After checking the badge in iOS there is not number at all present no less a 10.
I have no errors output on the terminal screen.

Thanks in advanced, great plugin concept!

Build doest not work (intel xdk)

Hi,
since your last update i' facing a build error but i don't have logs to show you.
the build error only appears on Android build, not IOS.
the problem appears since the update badge for android :
Support for app icon badges on selective Android platforms
thanks in advance :)

The build failed. An error occurred while building the application. Verify your build assets are correct and try again.
Build Log:
Building a Cordova 4.1.2 application.
The application name is "Clara-M"
The package name is "com.eurofirstmultimedia.claram"
Preference android-signed set to false. Application will not be signed.
Plugin "org.apache.cordova.device" (0.2.13) installed.
Plugin "org.apache.cordova.splashscreen" (0.3.5) installed.
Plugin "org.apache.cordova.contacts" (0.2.15) installed.
Plugin "org.apache.cordova.file" (1.3.2) installed.
Plugin "org.apache.cordova.file-transfer" (0.4.8) installed.
Plugin "org.apache.cordova.geolocation" (0.3.11) installed.
Plugin "org.apache.cordova.globalization" (0.3.3) installed.
Plugin "org.apache.cordova.inappbrowser" (0.5.4) installed.
Plugin "org.apache.cordova.dialogs" (0.2.11) installed.
Plugin "org.apache.cordova.vibration" (0.3.12) installed.
Plugin "org.apache.cordova.statusbar" (0.1.9) installed.
Plugin "com.intel.xdk.file" (1.0.1) installed.
Plugin "com.intel.xdk.device" (1.0.7) installed.
Plugin "org.apache.cordova.camera" (0.3.4) installed.
Plugin "org.apache.cordova.media-capture" (0.3.5) installed.
Plugin "org.apache.cordova.network-information" (0.2.14) installed.
Plugin "nl.x-services.plugins.socialsharing" (4.3.19) installed.
Plugin "com.phonegap.plugins.facebookconnect" (0.10.1) installed.
Plugin "com.phonegap.plugins.PushPlugin" (2.4.0) installed.
Plugin "cc.fovea.cordova.purchase" (3.11.0) installed.

Badge not showing in Kitkat (4.4)

Hi everyone, i'm using this plugin, when i set a new badge (with custom configuration) it show a message, just like a push notification, but the badge is not showing in the icon, do you have an idea why this happens? thanks!

localNotification together with badge

I had the local-notification plugin installed and it was working fine

 cordova plugin add de.appplant.cordova.plugin.local-notification

then I tried to install badge because I was not able to clear the badge icon

 cordova plugin add de.appplant.cordova.plugin.badge

Now I'm getting this error when I try to build in xcode

duplicate symbol _UIApplicationRegisterUserNotificationSettings in:
.../Debug-iphonesimulator/On-the-Go.build/Objects-normal/x86_64/AppDelegate+APPBadge.o
.../Debug-iphonesimulator/On-the-Go.build/Objects normal/x86_64/AppDelegate+APPLocalNotification.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

some issues with 0.5.2 version

I am using PGB 3.4 with your plugin 0.5.2
this is my code

window.plugin.notification.badge.get( function (badge) {
    // alert('Badge of the app icon: ' + badge);
}, scope);

function scope() { alert('scope'); }

issue one (occur in Android 4.0.3 or 4.1.1 or ...,ios and winphone are all work)
Step 1,I use "window.plugin.notification.badge.get" method to get the badge value,it will return 0,good
Step 2,I use "window.plugin.notification.badge.set(10);" method to set the badge value
Step 3,I use "window.plugin.notification.badge.get" method "again" to get the badge value,it will return 10,good
Step 4,I use "window.plugin.notification.badge.clear" method to clean all badge value
Step 5,I use step 3 again,but it still return 10 but not 0

no mater I use Step 4 Several times,it still return 10
unless,remove the app,re install again,use step 3,It will return 0 finally

issue two
the "scope" function seem not trigger in every platform,because of the "alert" not happened

Configuring?

So on iOS it shows badges and on android is shows notifications in the status with an email icon.
How do i replace the small email icon in it?

cordova.plugins.notification.badge.configure({ smallIcon: 'icon' });

What is this smallIcon should i a provide a location to the icon or something? and when will version 0.60 be released so that i can use configure?
Is it possible that i can show a notification as well on iOS then i can use the same code for both.

android-support-v4.jar

After you minimized the android-support-v4.jar, there is an issued building for Android if you use another plugin that uses this jar, such as the Facebook Connect Plugin.

Adobe thinks you should update your jar to reflect the current Android release. http://community.phonegap.com/nitobi/topics/dependency-problem-between-facebookconnect-and-localnotification-plugins.

[dependency] Found 2 versions of android-support-v4.jar in the dependency list,
[dependency] but not all the versions are identical (check is based on SHA-1 only at this time).
[dependency] All versions of the libraries must be the same at this time.
[dependency] Versions found are:
[dependency] Path: /project/com.phonegap.plugins.facebookconnect/LoyaltyNoggin-FacebookLib/libs/android-support-v4.jar
[dependency] Length: 758727
[dependency] SHA-1: efec67655f6db90757faa37201efcee2a9ec3507
[dependency] Path: /project/libs/android-support-v4.jar
[dependency] Length: 19036
[dependency] SHA-1: bc202617b4cfed6673b1e10d87e52c78f7a6de38

Thanks
Greg Alton
Loyalty Noggin

Customize android icon

This plugin is really awesome, however in android I'd like to know if there's a chance to make the small icon in the preview at the notification bar to be customizable in the future, or be able to remove the icon at all.

For example to show a smaller version of the application icon, which is mapped already once you open the notification bar.

In most of applications the mail icon is out of context

undefined is not a function when trying to use setClearOnTap

Hey there,

I'm developing an iOS application with jquery mobile 1.4.2 and phonegap build 3.3. I have this code on my index.html

      document.addEventListener("deviceready", onDeviceReady, false);

        function onDeviceReady() {
            phonegap_ready.resolve();
            if (device.platform === 'iOS' && parseFloat(device.version) >= 7.0) {
                StatusBar.overlaysWebView(false);
                StatusBar.show();
            }
            window.plugin.notification.badge.setClearOnTap(true);
        }

However when I ran the app I noticed it wasn't refreshing the badge icon number. Then I opened the app in debug mode, and when I executed the same line of code the console threw an error saying "undefined is not a function (evaluating window.plugin.notification.badge.setClearOnTap(true);)"

Is this method implemented already? am I using it wrong?

Thanks for your time!

Here are some issue and suggestion

Android 4.03 and Android 4.1.1

issue
http://developer.android.com/images/ui/notifications/normal_notification_callouts.png
when the message appear and click it
4.03 will reback to the app
4.11 will reopen another same app (it means to see the splash screen again and other initiallize thing)

suggestion(maybe future new version)
look at this picture
http://developer.android.com/images/ui/notifications/normal_notification_callouts.png
I hope the text "new message" can be Definitions by myself,if could,This will become more resilient

Error when trying to add the plugin

How can this be resolved?

Error happened [TypeError: Object.keys called on non-object]
TypeError: Object.keys called on non-object
    at Function.keys (native)
    at Object.getPluginFromFetchJsonByLocator (C:\Users\x\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\state.js:734:26)
    at Object.savePlugin (C:\Users\x\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\state.js:670:36)
    at C:\Users\x\AppData\Roaming\npm\node_modules\ionic\lib\ionic\cordova.js:90:22
    at _fulfilled (C:\Users\x\AppData\Roaming\npm\node_modules\ionic\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\x\AppData\Roaming\npm\node_modules\ionic\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Users\x\AppData\Roaming\npm\node_modules\ionic\node_modules\q\q.js:749:13)
    at C:\Users\x\AppData\Roaming\npm\node_modules\ionic\node_modules\q\q.js:557:44
    at flush (C:\Users\x\AppData\Roaming\npm\node_modules\ionic\node_modules\q\q.js:108:17)
    at process._tickCallback (node.js:355:11)

App Crashes In IOS7

The app crashes in IOS7 if its built under IOS8.
This issue is mentioned but i have fixed it by doing a check on runtime with the following code:

/**

  • If the app has the permission to show badges.
    */
    • (BOOL) hasPermissionToSetBadges
      {

      ifdef __IPHONE_8_0

      if(NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
      UIUserNotificationSettings *settings = [[UIApplication sharedApplication]
      currentUserNotificationSettings];

      return (settings.types & UIUserNotificationTypeBadge);
      }else{
      return YES;
      }

else

return YES;

endif

}

hope it helps.
Thanks

badge number not showing on android emulator and device

Just tried the example by 'cordova emulate android' and 'ionic run android' on my device.

When click 'set 10' it does shows notifications on message center. However, the badge number is not showing on home screen or app page's app icon.
image

Android build is not working anymore

Hello Katzer,

I've updated your plugin and it seems that i can't build my app anymore.
I'm receiving the following error:

/platforms/android/src/de/appplant/cordova/plugin/badge/LaunchActivity.java:32: Error: This class should be public (de.appplant.cordova.plugin.badge.LaunchActivity) [Instantiatable]

It looks like it's because of the changes in c123e8f

install issue

Failed to install 'de.appplant.cordova.plugin.badge':CordovaError: Plugin doesn't support this project's cordova-android version. cordova-android: 3.7.1, failed version requirement: >=4

iOS question: Badge cleared when switching between apps with double click on home button

Hi, forgive me if this is the wrong place to ask.

I'm having some trouble with using the plugin through ng-cordovas badge.js (https://github.com/driftyco/ng-cordova/blob/master/src/plugins/badge.js) in an ionic app.

On cordovas resume event I trigger the bagde update (from my app.js file):

Typescript:

    .run("$timeout", "$ionicPlatform", "$cordovaBadge", "BadgeCounterService", "TaskResource", ($timeOut:ng.ITimeoutService, $ionicPlatform:ionic.IonicPlatform, $cordovaBadge:ngcordova.Badge, badgeCounterService:ft.badge.BadgeCounterService, taskResource:ft.resources.TaskResource) => {
        $ionicPlatform.on("resume", () => {
            console.log("Resuming app");
            taskResource.getTaskCount((taskCount:l.TaskCount) => {
                // Without timeout here, of at least 500ms the badge won't be set through the service even on single tap of home button.. for some reason.
                $timeOut(() => {
                    badgeCounterService.updateTaskCount(taskCount:l.TaskCount);
                }, 500, false);
            });
        });
    }])

The badgeCounterService impl:

Typescript:

public updateTaskCount(num:number):void {
  this.$cordovaBadge.set(num);
  this.taskCount = num;
}

So the above two code snippets code work (with the exception that I have to set a timeout) when the user normally presses their home button once and goes i and out of the app. The problem occours when the user double taps and switches to e.g. Safari and then double taps back to the app. The count is retrieved and the bagde is updated correctly inside the app, but is not set on the icon on the home screen.

I've also tried to simplify the code (it's still from ionics run method though):

Typescript:

document.addEventListener("deviceready", ()=> {
    var config = setTimeout(() => $cordovaBadge.configure({autoClear: false}), 0);
    console.log("Config: ", config);
}, false);

document.addEventListener("resume", () => {
    $cordovaBadge.set(100).then(() => {
            $cordovaBadge.get().then((num) => {
                console.log("number on homescreen: ", num)
            })
        });
}, false)

But still no luck. In this case, without the timeout, the badge number is not set on home screen at all. The console log of badge number on homescreen is also inconsistent:

2015-06-02 10:49:50.354 app[1147:111758] number on homescreen:  100
2015-06-02 10:49:50.785 app[1147:111758] active
2015-06-02 10:49:52.576 app[1147:111758] number on homescreen:  100
2015-06-02 10:49:52.970 app[1147:111758] active
2015-06-02 10:49:55.058 app[1147:111758] number on homescreen:  0
2015-06-02 10:49:55.474 app[1147:111758] active
2015-06-02 10:49:57.207 app[1147:111758] number on homescreen:  100
2015-06-02 10:49:57.630 app[1147:111758] active
2015-06-02 10:50:06.227 app[1147:111758] number on homescreen:  0
2015-06-02 10:50:06.517 app[1147:111758] active
2015-06-02 10:50:17.075 app[1147:111758] number on homescreen:  0
2015-06-02 10:50:17.350 app[1147:111758] active
2015-06-02 10:50:19.965 app[1147:111758] number on homescreen:  100
2015-06-02 10:50:20.387 app[1147:111758] active

Log statement for config reports that autoClear is set to false. Any thoughts?

Xcode compile error when used with de.appplant.cordova.plugin.local-notification

Version 0.6.3 supposedly resolves the duplicate _UIApplicationRegisterUserNotificationSettings symbol issue with the local-notification plugin, but I'm still getting that error for AppDelegate.o and AppDelegate+APPLocalNotification.o, I guess because UIApplicationRegisterUserNotificationSettings is extern const but is assigned to in both files. A #define guard might be the simplest solution if that's the only issue.

badge.js doesn't load

Somehow badge.js doesn't load, so I can't access its methods. But I can run something like cordova.exec(null, null, 'Badge', 'setBadge', [3]) directly in my script.

Any idea what might be wrong?

How to use with PG HTML/JS

Dear,

I develop aplications with Phonegap without native SDK´s, instead of Dreamweaver ( html+js+css ).

I´am sorry, but i have not clear how to call in the html to clear the badge in some cases, for example:

  • When i press a link
  • When i turn the app pass from inactive ( springboard menu ) to active
  • When i open the app completily.

Can you help a little ?

Thx you.

The badge is not showing when I remove/add platform android

Hello,
When I build the android application from cordova-plugin-badge-example, the badge is showing correctly on the icon (I have a samsung galaxy Note II). But when I do:
"cordova platform remove android"
"cordova platform add android"
"cordova run android"
The badge is not showing anymore after that (for information, I need to tape these commands to install correctly a notification push plugin).
Any idea to how correct this problem?

Thanks in advance!

Android question: The badge comes as notification instead of a badge

var androidBadge = cordova.plugins.notification.badge;
androidBadge.configure({ smallIcon: 'icon' });
androidBadge.set(6);

I use this when messages come in. And instead of showing 6 as a badge icon. It shows it as a notification. '6 new messages'.

I am testing on a HTC One M7

Thanks

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.