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

Conflicts with cordova-plugin-firebase #66

Open
arrrash opened this issue Aug 28, 2018 · 10 comments
Open

Conflicts with cordova-plugin-firebase #66

arrrash opened this issue Aug 28, 2018 · 10 comments
Labels

Comments

@arrrash
Copy link

arrrash commented Aug 28, 2018

In our Ionic project after installing cordova-plugin-firebase the battery-status loses its functionality.
But when we remove cordova-plugin-firebase it work fine.

Will be appreciated if you can help in this regard.

more info :
cordova -v -> 8.0.0

@janpio janpio added the support label Aug 28, 2018
@janpio
Copy link
Member

janpio commented Aug 28, 2018

Which OS? OS version?
What Cordova Platform version?
What plugin version?

Any error messages or what does "loses its functionality" mean?

@arrrash
Copy link
Author

arrrash commented Aug 29, 2018

I am on macOS high Sierra 10.13.6
Cordova Version is 8.0.0
Plugin version ->

actually there is no error of any type during build or after build. Simply the event on battery-status is not present any more.

@janpio
Copy link
Member

janpio commented Aug 30, 2018

OS = Android, iOS?
Cordova Platform = e.g cordova-android 7.1.1
Plugin Version should not be empty - if you posted some code, use the <> button above the input field to make it visible.

What is your ionic info output?

Simply the event on battery-status is not present any more.

What does that mean, "not present"? Is it not triggered any more? Does it not exist any more?

@janpio
Copy link
Member

janpio commented Aug 30, 2018

Please try to recreate the problem with a new project created with cordova create. Put the demo project up on Github if you can reproduce it.

@arrrash
Copy link
Author

arrrash commented Aug 31, 2018

Hi there. plugin version is not empty, github seems to chopped it off. Both firebase and battery-status are are on their latest version.
the plugin exist but to working (i.e if you add window.alert for battery change status, if you add firebase plugin, the popup and all other methods in battery-status is not working)

firebase version atm : 0.1.22
Battery-status-version : 1.2.5

But I update both to the latest stable version but that does not help.
I will create a repo with these two to check how it works.

Ionic:

ionic (Ionic CLI) : 4.1.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic1 1.3.3
@ionic/v1-toolkit : 1.0.0

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : ios 4.5.5
Cordova Plugins : no whitelisted plugins (15 plugins total)

System:

ios-deploy : 2.0.0
ios-sim : 7.0.0
NodeJS : v10.8.0 (/usr/local/Cellar/node/10.8.0/bin/node)
npm : 6.2.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000

@cyptus
Copy link

cyptus commented Apr 17, 2019

i got the exact same issue, is there any workaround available?

@sbrannstrom
Copy link

I have the same issue as well. Is there any update on this?

@cyptus
Copy link

cyptus commented Sep 2, 2019

try registering the battery event with

import { fromEvent } from 'rxjs';
import { BatteryStatusResponse } from '@ionic-native/battery-status/ngx';

fromEvent<BatteryStatusResponse>(window, 'batterystatus').subscribe(async (status) => {
//...
});

instead of batteryStatus.onChange().subscribe(...) as a work around.

more info: danielsogl/awesome-cordova-plugins#2972

@sbrannstrom
Copy link

sbrannstrom commented Sep 2, 2019

Thanks @cyptus but it's not working....

I'm calling this function from ngOnInit():

batteryStatus() {
    fromEvent<BatteryStatusResponse>(window, 'batterystatus').subscribe(async (status) => {
      this.batteryStats = status.level;
      console.log('Battery status: ', status);
      if (status.level !== null) {
        this.userService.updateUser({ batteryStatus: this.batteryStats });
      }
    });
  }

console logs this:

[console.log]: "Battery status : " {
"isTrusted": false,
"level": null,
"isPlugged": false
}

I don't know if I'm doing anything wrong but I can't get it to work at all.

@EYALIN
Copy link

EYALIN commented Apr 11, 2023

@janpio @arrrash @cyptus @sbrannstrom @infil00p Instead of maintaining this plugin only for me, I published a new maintained plugin called "community-cordova-plugin-battery-status" (https://github.com/EYALIN/community-cordova-plugin-battery-status) which is maintained and will keep being.
please feel free to use it, and write me any feedback.
can be installed by using "cordova plugin add community-cordova-plugin-battery-status"
all Android and IOS recent issues are fixed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants