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

After Installing as mentioned on Ionic 3, Angular 4 this backbutton is not invoking on android devices #4

Open
chaityashah opened this issue Dec 3, 2018 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@chaityashah
Copy link

I have Cordova Ionic application with Ionic3 and Angular 4, where I installed this plugin and configured the same way it is mentioned, however still I am not getting into the onbackbutton function on any page when pressing Hardware back button on android device. Tested on samsung galaxy s8 and s8 plus devices.

@rabamus
Copy link
Contributor

rabamus commented Dec 3, 2018

Hi @chaityashah,

Could you possibly post an example of how you've used it?

Thanks,
Rob

@chaityashah
Copy link
Author

chaityashah commented Dec 3, 2018

So due to policy, I cannot share complete code, however I will post the file name where and how I have used this : possibly that might help you, and if anything further needed let me know.

so in my Ionic App,

  1. app.module.ts
import { HardwareButtons } from '@scaffold-digital/ionic-hardware-buttons';
providers: [ HardwareButtons
  ]
  1. Package.json
    "@scaffold-digital/ionic-hardware-buttons": "^1.1.0",

  2. app.component.ts

import { HardwareButtons } from '@scaffold-digital/ionic-hardware-buttons';
constructor(
    public hardwareButtons: HardwareButtons
  ) {
    this.platform.ready().then(() => {
      hardwareButtons.init();
      if ( this.platform.getQueryParam("platform") !== undefined ){
        // pluginsLoader.load(this.platform.getQueryParam("platform"),this.platform.getQueryParam("version")).then(()=>{
    
        pluginsLoader.load(this.platform.getQueryParam("platform"),this.platform.getQueryParam("version"));
          document.addEventListener("deviceready", function(){
            curr.onDeviceReady(curr,true);
          }, false);
        
      }else{
        this.onDeviceReady(this,false);
      }
    });
  }
  1. home.ts // This is my home page of the Application
import { BackButton } from '@scaffold-digital/ionic-hardware-buttons';
 @BackButton()
    public onBackButton() {
        alert('Back button pressed');
        return false;
    }

@chaityashah
Copy link
Author

Is there any update ?

@omsysdesign
Copy link

I Found this error.

ERROR in node_modules/@scaffold-digital/ionic-hardware-buttons/dist/providers/hardware-buttons.d.ts(1,47): error TS2307:
Cannot find module 'ionic-angular'.
[ng]

Please any body help me

@jiaqi-xiao
Copy link

I Found this error.

ERROR in node_modules/@scaffold-digital/ionic-hardware-buttons/dist/providers/hardware-buttons.d.ts(1,47): error TS2307:
Cannot find module 'ionic-angular'.
[ng]

Please any body help me

You can use '@ionic/angular' instead of 'ionic-angular' but there's no 'App' and 'ViewController' in '@ionic/angular'. All in all, the version of this plugin is out of date.

@untilbit
Copy link

untilbit commented Mar 4, 2019

Could you upgrade this plugin for Ionic 4.

@abgrano
Copy link

abgrano commented Mar 8, 2019

Please update this plugin for ionic 4.

@rabamus
Copy link
Contributor

rabamus commented Mar 8, 2019

Hi folks,

Am currently up to my eyes with various other things but I'll try and get this updated asap. In the mean time if anyone feels like taking a stab at it I'm happy to accept PRs 😃

Cheers,
Rob

@rabamus rabamus self-assigned this Mar 8, 2019
@rabamus rabamus added the bug Something isn't working label Mar 8, 2019
@untilbit
Copy link

Hope you can update it soon.

@akildemir
Copy link

I am using Samsung S8 for testing and the decorator actually works. I mean I enter the inside the function but when I say this.navCtrl.pop() I get error that says navCtrl is not defined although it is defined in the constructor. Is the decorator tries to run before the constructor? Why can this happen?

@08Thug
Copy link

08Thug commented Nov 6, 2019

Dood are you gonna show interest in this isssue? @rabamus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants