Hi,
I want to include in an Android app, the detection from the system back button on an Android device.
Does any one have an idea ?
Thanks
How to program the system back button on an Android device
How to program the system back button on an Android device
Windows 11 x64
Purebasic 6.04, Spiderbasic 2.51
Purebasic 6.04, Spiderbasic 2.51
Re: How to program the system back button on an Android device
Have a look in the docs on BindCordovaEvent("backbutton", @yourcallback())
Re: How to program the system back button on an Android device
Thanks hoerbie,
I have find this topic /
viewtopic.php?p=5398&hilit=BindCordovaEvent#p5398
But its doesnt work !
I have find this topic /
viewtopic.php?p=5398&hilit=BindCordovaEvent#p5398
But its doesnt work !
Windows 11 x64
Purebasic 6.04, Spiderbasic 2.51
Purebasic 6.04, Spiderbasic 2.51
Re: How to program the system back button on an Android device
Hi,
I can check my codes next week, when I‘m back in office. But until now I only use this to disable all buttons on Android.
I can check my codes next week, when I‘m back in office. But until now I only use this to disable all buttons on Android.
Re: How to program the system back button on an Android device
Hi,
please try something like the following:
Can't test it now, but this is copied from my sources, removed my code and changed to demo debug, so it should work this way.
On https://cordova.apache.org/docs/en/late ... vents.html you can find additional Cordova events.
please try something like the following:
Code: Select all
Procedure BindCordovaEvent(Event.s, *Callback)
!document.addEventListener(v_event, p_callback);
EndProcedure
Procedure back_event()
Debug "CordovaEvent: back"
EndProcedure
Procedure volumeup_event()
Debug "CordovaEvent: volume up"
EndProcedure
Procedure volumedown_event()
Debug "CordovaEvent: volume down"
EndProcedure
Procedure resume_event()
Debug "CordovaEvent: resume"
EndProcedure
Procedure pause_event()
Debug "CordovaEvent: pause"
EndProcedure
;only for Android:
BindCordovaEvent("backbutton", @back_event())
BindCordovaEvent("volumeupbutton", @volumeup_event())
BindCordovaEvent("volumedownbutton", @volumedown_event())
;for Android and iOS
BindCordovaEvent("resume", @resume_event())
BindCordovaEvent("pause", @pause_event())
On https://cordova.apache.org/docs/en/late ... vents.html you can find additional Cordova events.
Re: How to program the system back button on an Android device
Hi
Thanks hoerbi,
It's fine.
Thanks hoerbi,
It's fine.
Windows 11 x64
Purebasic 6.04, Spiderbasic 2.51
Purebasic 6.04, Spiderbasic 2.51
Re: How to program the system back button on an Android device
Just tested on my phone (a Pixel 7 pro) and it worked flawlessly. Thanks a ton for this!
hoerbie wrote: Mon Mar 18, 2024 7:07 pm Hi,
please try something like the following:Can't test it now, but this is copied from my sources, removed my code and changed to demo debug, so it should work this way.Code: Select all
Procedure BindCordovaEvent(Event.s, *Callback) !document.addEventListener(v_event, p_callback); EndProcedure Procedure back_event() Debug "CordovaEvent: back" EndProcedure Procedure volumeup_event() Debug "CordovaEvent: volume up" EndProcedure Procedure volumedown_event() Debug "CordovaEvent: volume down" EndProcedure Procedure resume_event() Debug "CordovaEvent: resume" EndProcedure Procedure pause_event() Debug "CordovaEvent: pause" EndProcedure ;only for Android: BindCordovaEvent("backbutton", @back_event()) BindCordovaEvent("volumeupbutton", @volumeup_event()) BindCordovaEvent("volumedownbutton", @volumedown_event()) ;for Android and iOS BindCordovaEvent("resume", @resume_event()) BindCordovaEvent("pause", @pause_event())
On https://cordova.apache.org/docs/en/late ... vents.html you can find additional Cordova events.