I'm testing my Windows Phone 8 app for scenarios where my app goes to the background before it can fulfill a consumable purchase. So, on every app-launch I check if there are any unfulfilled in-app purchases, if there are, I fulfill them using the CurrentApp.ReportProductFulfillment method.
However, while testing I noticed this method works even if the device isn't connected to the Internet. So how and when does the app let the Marketplace know that the purchase has been successful? More importantly, should I only do this only if I have an Internet connection?
This is my code by the way :
var licenses = CurrentApp.LicenseInformation.ProductLicenses;
if (licenses["PRODUCT_ID"].IsConsumable && licenses["PRODUCT_ID"].IsActive) {
// Fulfill consumable purchases
// Let the Marketplace know
CurrentApp.ReportProductFulfillment("PRODUCT_ID");
}
Marketplace communications occur on a background task spawned by the OS on regular intervals. You can observe this traffic if you attach Fiddler to a machine running Windows Phone emulator
The following statements are merely suppositions on my part, so take it with a grain of salt. I would imagine the background Marketplace communication handles a number of tasks. The most common of these would be checking for application updates. However, this would also be an ideal time for the OS to communicate fulfillment of an order. In that vein, Marketplace services likely queue your report request and, if it cannot be communicated immediately, defers it for the background task to handle at a later time, allowing the method to run even when the phone does not have data access. Given the nature of modern cashless transactions, I don't see any reason the Marketplace would require immediate notification of fulfillment, as it has time to complete a transaction once initialize authorization is acquired.
CurrentApp.LicenseInformation.ProductLicenses is cached by the windows phone operating system.
Related
I'm developing a line of business app for Windows 8.1, that is, I am not deploying through the Windows Store and will be able to control all of the features of both the OS and hardware this app is being deployed on.
Because this app is working as the UI in a real-time situation I would prefer if I could ignore the life-cycle events and not have the app suspend or terminate at the whim of Windows 8. Does anyone know of a way to do this?
I have seen some older answers, such as this one and this other one indicating otherwise, but I haven't yet found anything more recently and specifically dealing with the case of a line of business app. I have found the Embedded Lockdown Manager which would prevent the app losing focus and addresses some of the needs I have, but I still would like a way to simple disable Lifecycle events.
Have you tried Assigned Access Mode? Basically use PC Settings -> Accounts to lock an account to a single app. You have to reboot the device and log-in again in order to run anything else.
I have seen several apps on the market that are allowing users to determine their current network connection speeds. How is this possible, and what might I use to be able to use this functionality? I am querying network types but I am not sure how to determine the current speed of the connections.
Besides the NetworkInformation class that gives you basic information about the connectivity (network available or not, wifi enabled or not) there is no API with the current SDK for determining network speed.
I guess the apps doing this simply create a web request to download some sample files hosted on their website and measure the time it takes, etc.
Does WP8 have any OS hook or callback (sync mechanism) I can implement to get a notification when a contact changes?
For example I'm running an application as a background agent, and a user randomly changes a contact's details. I want to get notified in my background engine so that I can do various operations.
I could always implement a periodic check (say every minute I read all contacts and check to see if there are any modifications - assuming I'm remembering the last configuration somehow). But this solution is not efficient for a large number of contacts, especially when I want the application to run on the low end phones.
Windows Phone does not support any built in way for applications to be notified of contact changes.
As you've noted, the only way to do this would be to track the details and periodically look for differences. Yes, you'd have to do this with the app running (rather than a background agent) if you want to support WP7 devices with one 256MB of memory.
As an alternative and assuming that the user is syncing their contacts with their live.Windows account you could create an external service that periodically polls their live account (via http://msdn.microsoft.com/en-us/live/ff519582.aspx) for changes and then send a notification to the device/app regarding the change.
I'm trying to find out in my app is there network available using Tools/Simulation Dashboard in Visual Studio 2012 for WP 8 app (of course, debug mode is on).
Whatever I do I got for DeviceNetworkInformation.IsNetworkAvailable always true although I set Control setting to No Network. But if I try some activity in app that need network access I can't do that (so it works but withoud detection which is my primary goal).
Are they any thing to do to get False to my query and to do i.e. Message Box that says "No Network available".
Also,
DeviceNetworkInformation.CellularMobileOperator
always return Fake GSM Network" with No Network setting set to. When I change setting I got "Simulation setting were applied succesfully" in VS status bar.
Thanks for the question. I will answer based on the fact that I designed this feature as a Program Manager in Microsoft.
Simulation Dashboard currently only throttles the Network Bandwidth (limited by your current network) and do not simulate "actual" network conditions. So APIs will still return the "actual" network type and/or name but the network speed/quality will be affected as per your choice when the Network Simulation is enabled. In case you want to validate the API calls, you might have to test your app on a Windows Phone device with data connection switched off.
I’ve been developing Windows desktop applications for many years, but just started developing Windows Phone 8 applications so, as you can imagine, I have many questions and doubts.
This is my problem so far:
I need an application to check any certain time if there are new messages / notifications in the server database, even if the application is not running, and show it (in some way, not sure how) on the phone. At the end, I want something similar to Facebook application (or others) that checks constantly if there are new messages even if I’m not using the phone.
How can I do that? Is there any tutorial or guide that explains that?
Thank you very much
There's two mechanisms available on Windows Phone to periodically check a data source and display notifications:
Push notifications: the server directly sends the notification to the phone. It provides the best user experience, because the notification is send (nearly) instantaneously, and because all the processing is done server-side (so it doesn't impact the phone's autonomy). The obvious drawback is that you need a server infrastructure to send the notifications.
Background agents: your application runs in background, is woke up periodically (every 30 minutes or so), and is allowed to run for about 15 seconds. During those 15 seconds, you can check your data source, and display a notification if needed. The two major drawbacks are that you can't choose when you're background agent executes (so the notification can be displayed 30 minutes late), and it'll have an impact on the battery life.
What you need is push notifications.
Microsoft already provides this functionality throught Azure Mobile Services and here is something to get you started : Get started with push notifications in Mobile Services