I am working on a game on OSX with In App Purchases.
I am trying to detect when the Popup that says "Thank You, Your purchase was Successful." At the end of a successful Purchase by the user.
The Problem that I am having is I need to hide the mouse and resume input on the game after this message has been dismissed, but I can't find a suitable place to do this.
How can I find out if the OK button has been pressed on this message box?
Okay, so I found a fix to my problem.
I couldn't find a way to detect when an alert is shown from another Application, as all the the In App Purchase popups come from the App Store.
The fix I used was to make sure that the App Store was open before starting the transaction. This means that OS, whether or not you are in full screen, will automatically take you to the App Store. This causes the Alerts to be shown as sheets inside the App Store rather than in front of your application. Problem solved.
I open the App Store immediately before instigating the transaction by calling this line of code:
[[NSApp mainWindow] makeKeyAndOrderFront:[NSApp mainWindow]];
Then once the transaction finishes I grab focus on my App again.
Related
I'm new to Windows Phone development and I've found something about background agents in WP 7.5:
http://code.msdn.microsoft.com/wpapps/CSWP7ScheduledTaskAgent-6450bcf1
I wasn't able to find a way of making the toast notification fixed, I mean, when it appears on the screen it should disappear.
Is there any way of doing this? any advices, documentation should be great.
Thanks.
Toast Notification by the OS
When a toast notification is created, the OS handles the amount of time it is displayed for...
A toast notification displays for about 10 seconds unless the user
dismisses it with a flick to the right. If the user taps the toast, by
default, your app's start screen launches. Or, you can choose to
specify which screen of your app will launch.
Taken from the official documentation.
The API for toast notifications does not allow you to specify a time. Only a title, content and deep link into your app. This is the only type of toast/notification that can be used by a Background Agent. But it will appear:
on the Start screen
when your app is being used
when any other app is being used.
Custom toast-like notification (eg. Coding4Fun Toolkit's Toast Prompt)
A custom toast notification, although more flexible, must obey all the system rules unlike the system's Toast Notification which has special permissions.
This means the Coding4Fun Toolkit's Toast Prompt cannot:
Display notifications when your app is not running (apps cannot run in the background, they are essentially paused)
Display notifications when the user is on the Start screen or not using your app
Having a permanently (or long) displaying toast notification would be annoying to the user (hence the 10 second limit by the OS version) so do think carefully about why you need it - is the System Tray or MessageBox a better idea?
If you're new to Windows Phone, I would recommend using a handset for a while to get the feel for how the system works and how other apps use all kinds of notifications.
I'm a new Mac programmer writing my first mac app, actually porting an existing iOS app to MAC.
The app does a lot of remote communication, so when the user kicks off an operation, I want to display a busy window (or message box, or NSAlert maybe), until the operation is completed, then dismiss it programmatically, or the user can click cancel to stop it.
The busy window prevents the user from doing anything until that operation is completed.
The busy window should have a progress spinner, some text, and a cancel button.
Its such a simple thing yet I'm having problems with it because I dont really know MAC programming, getting myself frustrated.
Can anybody offer suggestions, or already written code for it. I hope some code for this already exists because I cant believe I'm the only person in the world who needs things kind of busy window.
Thanks for any help.
You mean something like this:
http://www.developers-life.com/example-nspanel-with-nsprogressindicator.html
???
Source code is available, too (link at the end of the article).
You can just modify the NSPanel in Xcode and add a "Cancel" button that you connect to your cancel action.
I am working on WP7 app.
In this am launching youtube url in Yotube app.
To return to my app from YouTube user will have to click back button twice, as per my research this is a known issue.
I need to show a message(inside youtube) to user like "Press back button again to return" whenever he presses back button.
How can I achieve this?
Welcome any comment!!
If I understand you correctly, you want to display a popup in another application? In your case a Youtube-app?
Unfortunately, you can not change the behavior of another app. There aren't any hooks in other apps from your own app.
That is not possible.
Using JUCE with TUIO, I'm developing a multi-touch utility to send "hot keys" commands to other applications (I am using a usb touch frame that sends TUIO messages). For instance, I provide an interface through which users can touch-and-hold to program a key combo and then tap that button to send the programmed key combo to another app. They way I accomplish this on OSX is by running my utility as a "background only" application (NSApplicationActivationPolicyProhibited). I use [NSWindow setCanHide: NO] so the GUI of my utility is visible even though it runs as a background app.
It works well except in the case that a window from another application is on top of mine. What happens is that touches get passed through that other app into mine- causing unintentional button pushes in my app. Normally, I could have my app only listen to the TUIO touch callback whenever is is the active application, [NSApp isActive]. But, since my app is background only, it is never active and I have no way to tell if another window is covering it to prevent touches.
So, is there any way for a "background only" app to be able to tell if it is on top of all other windows? Or, is there a way from within my app to get a list of all Cocoa windows from other applications and be able to tell if they are appearing on top of my "background only" app?
Also, does anyone know how I would go about all of the above in Windows? In other words, what is the Windows equivalent of NSApplicationActivationPolicyProhibited and would I be able to tell if it is covered by other applications' windows?
I'm developing my first Windows Phone 7 app. I don't yet have access to an actual device, so I am relying on the emulator that ships with the SDK.
In my app, I use the EmailComposeTask and SmsComposeTask where required. When debugging my app in the emulator, I click a button which runs one of these tasks, and it works. But when I then push the back button to get out of the task and back to my app, the app state is lost - it's as if I am launching it fresh all over again.
But, where it gets weird, is that on occasion this doesn't happen. I have gone back from one of the Tasks more than once to find my app state exactly how I left it.
And so, my questions:
Is this just a bug with the emulator?
If not, why is not consistent, and how should I be "saving" my app state prior to call the Email or SMS task?
Thanks.
Your page is being tombstoned which is why it seems like your application has restarted. This basically means that your app is still stored on the stack, ready to be called, but pages state and other data information is lost. To fix this, you need to handle the serialization of any data you want to keep.
For transient data, like page state things (e.g. textboxes, checkbox etc..), you can use PhoneApplicationPage.State. I believe the limit is 2mb. If you need to store more, you should store it in Isolated Storage (unlikely, unless you need to save an image). You can read about the process here. To understand the process of Tombstoning, you should read this MSDN page. To save time, you can use Tombstone Helper which handles all the lower level storage details for you, but it's a good idea to understand the process of Tombstoning anyway so you know what's going on.
The reason your app doesn't always get tombstoned is because EmailComposeTask doesn't cause a tombstone straight away. From this MSDN blog post:
Below is the list of native
experiences that, when invoked, do not
trigger an automatic tombstone in the
calling application:
PhotoChooserTask
CameraCaptureTask
MediaPlayerLauncher
EmailAddressChooserTask
PhoneNumberChooserTask
There are three scenarios in which an
application in the background will
immediately be tombstoned:
User forward navigates away from an application [for example, user
presses the Start key]
Application invokes launchers or choosers not listed above
System requires more resources to carry out a foreground activity
As you can see, that's not to say EmailComposeTask will never cause a tombstone, so you should still handle it, but it explains why your page state is sometimes kept automatically.