Google Play Games notifications not visible - google-play-games

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.

Related

WP7: Is it possible to intercept the backstack before the journal thumbnail is created/stored

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.

how can you query current user activity in WP7 background agent?

WP7 mango now supports background agents (with some limitations): http://blogs.msdn.com/b/danielegan/archive/2011/10/18/background-agents-in-wp7.aspx
How can I inspect the user's current activity? specifically, here is what i'd like to determine:
what is the active application
when was the last user interaction
I think the Microsoft way of doing this would be to provide developers with an API to modify Lock Screen system settings. This is not possible at the moment, but there is a petition to enable setting the wallpaper from an app here: http://wpdev.uservoice.com/forums/110705-app-platform/suggestions/1720049-provide-a-wallpaper-api-to-enable-in-app-setting-o?ref=title
This combined with the ability to change the screen timeout (not possible yet) would achieve the desired effect.
I take it you are probably after custom screensaver with some other information on it and/or rendered/animated content. This wouldn't make sense. The whole point of the screen saver is to save the screen.
There is no better way to save the screen than to turn it off, which mobile devices handle pretty well.
You can't do either. Windows Phone does not support inspecting the users activity or anything else that goes beyond the boundary of a 3rd party application's own domain.
The background agents are limited to the application that created them, and the data related to that (in it's isolated storage).
And this is a good thing, since it means creating mal- and spyware is a lot more difficult. Also, a application like you're attempting to make, would principally be considered spyware.

Calling NavigationService.GoBack() fails on the first page of a WP7 app

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.

How to handle first run and splashes in WP7

I have spent a bit of time rummaging through Stack Overflow to find out how to deterministically close an application based on an action. Most if not all answers say you can't or shouldn't do it. If this is so I would like to phrase my question differently and see how people are handling two issues I am having trouble with.
Just to let you guys know I am using Caliburn.Micro for this project.
Ok so the flow of my app can be broken down into two parts, the initial flow and the standard flow, these are as follows
Splash -> Welcome -> CreateAccount -> MainHub (all other functionality branches from here)
Splash -> MainHub (all other functionality branches from here)
Based on this flow, the feedback from my better (beta) testers is that they expect to exit the app on pressing the back button on the hub, which they see as the entry point. Currently as per navigation they go all the way back to the splash.
I see other apps have this functionality, but without forcing the application to close (Which I read is a no no) how are they achieving this desired functionality.
NOTE: I do not want to put in an exit button as I believe it goes against the natural flow of a WP7 application.
First of all, you cannot add a exit button. The only way to exit a application is to crash it, which will not be approved for marketplace certification.
As for your problem, you simply have to remove views from the navigation stack upon completion of a known navigation.
For this, use NavigationService.RemoveBackEntry.
You can access the NavigationService from anywhere, using this snippet:
(App.Current.RootVisual as PhoneApplicationFrame).RemoveBackEntry()
Regarding EULA / Login screens (and Splash) - don't make them into pages. If you instead make them Popup or Dialog controls you can show or hide them at any time (on first navigation; when the user hits a "protected" part of the app; after a time-out; etc.) and they don't consume a slot in the backstack.
Source: http://blogs.msdn.com/b/ptorr/archive/2010/08/01/exiting-a-windows-phone-application.aspx

Terminating a Share Picker app on load complete

I've implemented a Share Picker Extender (which lets you share a photo from the Pictures hub to your app via a special token), and would like to close the app once the user has clicked on the button to upload the photo, as the built-in Facebook app does.
I'm aware of the many questions re terminating apps - I'm just wondering if I'm missing something for Share Picker Extenders ... Telling the user "Now press the back button" seems pretty ugly, but perhaps it is the only (certification worthy) way. If you've implemented a Share Picker extender, what have you done?
I wasn't able to figure out a good way to handle this either. I detect that users have gone back to my first page and say "Click here to go to our main app" and "Click back to go pack to Pictures". And if they click the first one, Navigate("MainPage.xaml");. You have to make sure you don't accidentally prevent them from leaving. I asked this question awhile ago in this thread and got no response.

Resources