-
14 Apr 2012 12:58 AM #1
Unanswered: Sencha Touch Routers and Android's native back button
Unanswered: Sencha Touch Routers and Android's native back button
Hi All,
I have been working with Sencha Touch SDK and Tools (2.0.1 rc) hoping to see few improvements on native packaging.
Question I have is
Given I have an Sencha Touch 2 Application which uses routers and on navigation from one view to another view (the url changes from http://xyz.com/#home to http://xyz.com/#places ). Now if I package this application as android native application and launch it on Android Phone. And now If I navigate from say home view to places views and I hit native back button on android, What would happen today
1. Would my application stay there and I can see a navigation say back to home view?
2. Would my application close and I see the previous application/home screen of android?
I am trying this out, my conclusion is coming to the 2nd part, which I am pretty disappointed with. In case point 2 is how things work, then I will back to use PhoneGap underneath my Sencha Touch App.
Any answers or hints are welcome.
For people who will ask for a sample app, I am attaching Source-Code.zip (I removed resources and sdk folder) for you to try out. Let me know what am I doing wrong here. I am using ICS phone (Samsung Nexus S).
I am not able to get the back button in android working for android native apps, despite using routes
Cheers,
Rohit
-
16 Apr 2012 4:49 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
Native apps and their behavior aren't really taken into account a web site may be running within it. You would have to override the back button to accomplish what you want.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
26 Apr 2012 6:27 PM #3
Android Back Button in PhoneGap
Android Back Button in PhoneGap
To listen for and intercept Android hardware back button presses, it looks like you will
need to use PhoneGap. Look at
http://docs.phonegap.com/en/1.0.0/ph...tml#backbutton
-
9 May 2012 7:31 AM #4
I have the back button successfully overridden, any one have an example of manually firing a navigation view's back button?
-
9 May 2012 8:04 AM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
9 May 2012 8:14 AM #6
I kept getting errors for missing methods when I tried that. Finally settled on Ext.Viewport.getActiveItem().pop();
Which always called pop on my viewport anyway. Anything wrong with doing it that way?
-
9 May 2012 8:42 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
When I said use navigationview.pop(), navigationview was just an example variable describing the component.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Jul 2012 7:12 AM #8
Can you post example code of you how overrode the back button?
-
3 Jul 2012 10:12 AM #9
In launch:
In a function just beneath launch:Code:document.addEventListener("backbutton", this.backKeyDown, false);
Note...Cordova/PhoneGap makes that possible.Code:backKeyDown : function() { // Ext.Viewport.getActiveItem().pop() return the class it popped, if undefined quit app. if (Ext.Viewport.getActiveItem().pop == undefined || Ext.Viewport.getActiveItem().pop() == undefined) { navigator.app.exitApp(); } }
-
3 Jul 2012 11:22 AM #10


Reply With Quote