I have a strange problem with a Windows Phone (7.1/Mango) app.
My understanding is if NavigationService.GoBack() is called on the initial page of an app, then the app should exit. This happens when the user presses the phone's back button, but it does not happen if there's a UI button with the same functionality (because NavigationServive.CanGoBack returns false).
Is this intentional or am I missing something? I haven't messed around with redirecting the initial navigation or anything like that, so I can't account for this difference in functionality.
I know the answer is simply "don't have a UI back button", which is very true, but does anyone know why this happens?
Thanks in advance!
I believe this is because the navigation service is "scoped" to your application. This allows you to deduce a bit more about how the user is using your app.
For instance if CanGoBack is false then this is the first page the user is visiting. This is useful if you're using deep links into your app (from reminders or toast messages) because you may need to act differently on the deep link as opposed to a normal navigation to the page.
Related
I've looked through all questions on SO about Google Play Games, but looks like I'm the only one having problems now.
Using new GPG with Games.Achievements.unlock(), the achievement notification isn't showing up. I can see that achievement is unlocked when checking in unlocked achievements list, but that badge - it just doesn't show up!
The app isn't published, but has all the achievements correctly set up in Play Store. other GPG features seem to work fine, but they usually do not show notification (like Leaderboards)
And another issue that might be actually related to this. The initial login popup, the one that allows to pick an account when you have several of them on the device - sometimes it ends up being behind the app screen. And when you quit the app it keeps sitting on the device screen until you close it by picking Cancel. Not sure, this might be a debug issue due to app being force-closed on every next installation, but still.
Any ideas? How Achievement badge can end up being invisible all the time?
You may need to try changing the popup view, depending on which implementation you have used, this is the basegameutils method:
Games.setViewForPopups(getApiClient(), getWindow().getDecorView().findViewById(android.R.id.content));
Depending on your code, you may need to use a different view.
Try this in the activity view in which you want the notifications to be seen : Games.setViewForPopups(getApiClient(), getWindow().getDecorView().findViewById(android.R.id.content));
The issue was that I was calling Games.Achievements.unlock(mGoogleApiClient, context.getResources().getString(R.string.achievement_pro)); from a helper class. The context that I passed was of MainActivity.class, however I actually intended to show the achievements being unlocked in my GameScreen.class and not the MainActivity.class since it would be in the background. GameScreen.class, in my case, is an activity that I invoke through an Intent from MainActivity.class. And I suppose, it is because of this that the context is not set properly for Games.Achievements and it could not show the pop ups in my current activity screen.
When I added that line of code in GameScreen.class, I assume that now Games class knew where it has to popup the alerts. My explanation might sound a bit fussy here but let me know if you have any issue.
I'm creating an app that has start button which brings you to start page from anywhere in app.
However back navigation stack hurts when I just navigate to start page.
Looking for solution I found NonLinearNavigationService. The trouble is that download links are target to app hub, which (now, as we have new better app hub) redirects me to main page and nowhere further. Also I failed to find it on app hub using build in search engine.
Anyone knows where from can I get it?
Or maybe another solution for navigation loops?
If you use RemoveBackEntry(), the entries are programmatically cleared from the backstack so you don't have to deal with the side effects of actually navigating back through the pages to pop them off the stack.
The NonLinear Navigation Service effectively does what you have tried. It calls GoBack() to traverse back up the stack. What it additionally does to prevent the flicker is to make the root frame transparent. See this question:
Skip a page when the back button is pressed, WP7
I don't want to call your question a duplicate because I think before Mango came out, that was probably the solution that needed to be used. Now that RemoveBackEntry() has been added to NavigationService, I think using that would probably be the better approach.
No linear navigation in WP7 is generally not recommended, because of the hardware back button and the UX on the rest of the phone, so you should probably structure your app to avoid this. However it should pass the certification process.
Here's another similar question In-App Home Button to Navigate to MainPage allowed? and an article about circular navigation which mentions the NonLinearNavigationService you are talking about http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx.
If the only non-linear part of the navigation is the home button, you could use NavigationService.RemoveBackEntry() in a loop untill it raises an InvalidOperationException in the home button event. When the InvalidOperationException is raised the BackStack is empty and the next click on the back button exits the application.
You all know the Windows Phone backstack right. If you go through some apps, tap the Home key after starting each app. Now tap and hold the Backkey to see the Backstack. You can now see some small images of your apps, and can pick which one to go to right.
Question:
Is it possible to intercept before the backstack image is created? I have tried to blur my page in various events (include OnNavigatingFrom) to no avail.
My guess is some other event (probably something we don't have access to) is triggered and a bitmap is created, because when you use the Backstack to navigate you can just see a slight transition from the saved image to a real page IMO.
Does anyone know if its possible to intercept or manipulate these images on the backstack?
Example screenshot from WP emulator of the Backstack thumbnails
Following my comment, I've just tried this:
Set a breakpoint anywhere in the code
Start the app with the debugger attached, then let it reach the breakpoint
While the execution is stopped by the debugger, long press on the back button
The task switching UI is displayed even though the managed code execution is stopped
From there, I think we can safely conclude that the task switching and the thumbnail are handled entirely by native code. Therefore, there's nothing you can do.
I recently wrote a blogpost in which I discuss the ways I tried to hide data from the application snapshot. (You can read it here: http://corstianboerman.com/trying-to-hide-crucial-data-from-an-application-snapshot/)
The outcome: You just can't hide it.
I have a created an app which has a Homescreen/landing page,Now whenever user navigates till last page and clicks the device back button he is redirected back to Homescreen. Now the issue is I have written code to clear all the backstack whenever user lands on the Homescreen in Homescreen OnNavigatedTo block. So whenever user clicks device back button of last page he is navigated to homescreen by creating a new instance of HomeScreen page.
On Homescreen the backstack is cleared, so the user can exit the app from homescreen when he clicks the device back button.
But according to Microsoft marketplace policy, backbutton must go back or go to previous page in backstack and not navigate to new page.
So the question here is should I clear all my backstack and go to homescreen or what I am doing is right?
As far as I know, they are not so strict as that. They just want you to handle the back button.
I had blocked the back button in some pages of my application and the certification failed. I changed the behavior of the application, to either close the application when navigating back or jump a couple of pages back, and it passed certification.
Just make sure the back button does something...
The reason they dis-advise you from doing this is because you are using the wrong organisation.
Going deeper usually means you get too more specific data, in a way you can go back up one page.
Going to the side usually means that you get more data, eg. Panorama / Pivot
I can't see a case where going deeper would disallow the user from going back to pages in between, I would not use your application if I had to start it every time again or when it would go deeper when it is actually supposed to let me scroll through the content.
Trying to surround their certification is definitely not the way you should be going, but rather embrace it.
See this page for layout tips and tricks for the Panorama and Pivot controls.
As per the comments, you might find it a lot easier to ditch having to learn all platforms.
A jQuery Mobile application can do that for you.
jQuery mobile framework takes the "write less, do more" mantra to the next level: Instead of writing unique apps for each mobile device or OS, the jQuery mobile framework allows you to design a single highly-branded web site or application that will work on all popular smartphone, tablet, and desktop platforms.
I am trying to automate testing of WP7 apps. In my app, one functionality is CALL; ie; the page changes to WP's phone call page. While testing I want it to automatically come back from the phone call page to simulate a "back" press. I know we can use navigation service to perform back - press however I want to use the back-press on a different page which is not under my control(ie; default phone call page). Is there any way of achieving this?
NO, Current that is not supported in the WP7.
Even if any hacks make it possible also, your application doesn't meet the certification requirements.
So no point, in making this.