Get user information in Windows Phone 8 app - c#

I'm making a game which have a hightscore table (on my server), now I need to get a unique information of the player (email, MS accout name, Live ID...) or any other way to define people to add to the highscore, so is there anyway to get that information ?

Take a look at the ANID2. It is an identifier that is unique to the Windows Live ID of the user and the publisher ID of the app.
string anid2 = (string)Microsoft.Phone.Info.UserExtendedProperties.GetValue("ANID2");
To use this Api you have to add the "ID_CAP_IDENTITY_USER" capability in the app manifest. You may also find this blogpost helpful.

Related

How to identify a mobile User in Unity without an explicit registration

First of all, I have been searching forums for about a year for a viable solution. What I am looking for is a way to identify a mobile User by an ID that is NOT linked to the device.
So no SystemInfo.deviceUniqueIdentifier
My thoughts go out towards identifying Users using the Google Account of the User (Android) or the Apple account (iOS).
What I have tried so far is connecting the application through the GooglePlayGames API. It is successfully connected and works fine. It logs in automatically when I start the application and I retrieve and store the googleId in my database.
The drawback here however is that the app is now dependent on GooglePlayGames, which is something I dislike. I don't like explicit dependencies on other apps. And I also need to find a suitable equivalent for iOS.
I have yet to implement the Unity IAP to enable in app purchasing. I could not find any info on how transactions are linked to Users on android/ iOS. Is there a way to retrieve/store any User related Id during transactions?
It seems to me that when working with in app purchasing, that you need to have some way to reimburse/reactivate purchases made by users when they switch phones for example.
Best case scenario would be an easy way to store an Id without depending on Unity IAP, so that Free To Play Users can also easily recover their account.
You can use Mac Address. This is unique for every device.
string GetMacAddress()
{
string reesult = "";
foreach (NetworkInterface ninf in NetworkInterface.GetAllNetworkInterfaces())
{
if (ninf.NetworkInterfaceType != NetworkInterfaceType.Ethernet) continue;
if (ninf.OperationalStatus == OperationalStatus.Up)
{
reesult += ninf.GetPhysicalAddress().ToString();
break;
}
}
return reesult;
}
Now, if the device is jail-broken or tampered with, the Mac Address can be spoofed or temporary changed.
SystemInfo.deviceUniqueIdentifier is not 100% reliable, especially not
on IOS. Furthermore I will lose the connection to the User if he
switches device.
You can use Unity's SocialPlatforms API to check if the user is logged in then obtain the user id. That you can use to determine the user on any device.
Social.localUser.Authenticate(success =>
{
if (success)
{
Debug.Log("Authentication successful");
string userInfo = Social.localUser.id;
Debug.Log(userInfo);
}
else
Debug.Log("Authentication failed");
});
If you really need more control over your users, you should implement your own token-based authentication such as oauth2. It's not really hard to make one yourself if you have background of PHP and MySQL.
For iOS you need to implement the Apple Game Center.
The docs make it look pretty easy, looks like a single function call that will prompt the user to sign in if they're not already signed in.
Should work the same as the Google Play Store API after that.

Windows Store - Change Windows Phone 8.1 App Name

We tested a application on a test account, and now we want to release it on a production account.
Problem is, we reserved and used the actual name with the test account and we now want to use the same on production account, but it is blocked via our test account.
The application is un-deletable (Microsoft itself wrote article which states that) it can only be hidden.
Therefore I was thinking about reserving a new name in Manage App Names, use it, and then delete the old one. However, I can't figure out how to do this using Visual Studio 2013).
Lets say I have name X. I reserved name Y in the store (for the same app).
In Visual Studio:
Right click on Project -> Properties -> Assembly, name changed to Y
Display name in Package.appxmanifest changed to Y
Submitted to store - nothing changed, it still says that app name X is in use.
I did not find App Name property, but I supposed the assembly is it now?
Because in some older tutorial I saw "app name" at the same position as the Assembly now.
What you are looking for can't be solved in Visual Studio.
My understanding is your have name X reserved on a test account, and you want name X to be on a production account.
This is transferring an app to a different publisher (Test account and Production account are different, hince different publishers even though you own both)
Open a support ticket in the Windows Dev Center, and they should be able to sort this out for you: https://dev.windows.com/en-us
For achieving this you need to remove the reserved name from test account and then reserve this name in production account.
For reserving app name in Windows Store first login with the Microsoft account and go to Windows apps dashboard for your account and click on app name to go to app details and on left side click on App Management and then click on Manage app names here you can reserve a new name and also delete the unused app name. For further information Check this microsoft link. Hope it helps.
I actually fixed it.
I opened file "Package.StoreAssociation.xml" and I changed ReservedName value in bottom of this file to Y
I also changed the Package.appxmanifest->Packaging->Packade display name to Y
Also if you expand Properties, there is AssemblyInfo, I changed the AssemblyTitle and AssemblyProduct to Y
With the thing I already did :
Right click on Project -> Properties -> Assembly, name changed to Y
Display name in Package.appxmanifest changed to Y
I created bundle and uploaded it as new submission to Windows Store and then publish it. After this, the used reserved name changed from X to Y and I was able to delete X and then reuse him at production account.

Windows Phone - link to the publisher in the app store

I have created several windows phone apps and I would like to link to my publisher's page to show all of the apps that I publish. Note that I am developing my app for Windows Phone 7.x and up using C# and XAML.
UPDATE
What I would like to do is show the following publisher page: From within Windows Phone, navigate to the Windows Phone store, then select any app, then select the "more from <Publisher>" link. This displays a nice mobile view of all of that publisher's apps. But I can't figure out how to bring up that publisher page directly from within my app. Any help would be appreciated!
Option 1) Link directly to the URL for my publishers page (using a WebBrowserTask)
Issue) All links to the store seem to require the en-US language embedded in the URL. I'm concerned about what will happen to users in other countries/languages.
Example: http:/www.windowsphone.com/en-US/store/publishers?publisherId=Microsoft%2BCorporation
Is there a language independent way to link to a publisher in the store?
Option 2) Use the MarketplaceDetailTask to link to the publisher
Issue) From what I've seen, this can only be used to link to an app. I tried using my publisher GUID and got: Marketplace Error - We're sorry, but we can't complete your request right now.
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
marketplaceDetailTask.ContentIdentifier = <My Publisher GUID>;
marketplaceDetailTask.Show();
Option 3) Use the MarketplaceSearchTask to link to the publisher
Issue) This allows searching the store with any string. The problem is, when I put my publisher name in the search string, other apps are shown in addition to mine. My publisher name includes a common word and any app with that word shows up.
MarketplaceSearchTask searchTask = new MarketplaceSearchTask();
searchTask.ContentType = MarketplaceContentType.Applications;
searchTask.SearchTerms = "<My Publisher Name>";
searchTask.Show();
Any thoughts or suggestions would be appreciated!
Thanks.
As you're targeting WP7+, unfortunately using the zune:search URI only works on WP8 as it relies on URI Schemes, which was not backported to WP7. Based on these two posts, I tried the following on your behalf:
zune://search/?publisher=Henry%20Chong;
And a bunch of other things, but it seems that only zune://navigate is available on Windows Phone 7 and that only allows you to load a specific app. (Perhaps someone who feels like opening reflector or on the Phone teams could comment here...)
Two other things I've come across that you can look into:
1) There used to be an undocumented Zune api that you could query the marketplace against; it looks like this has been replaced by the Marketplace Edge Service, which you could try and dig around for:
http://social.msdn.microsoft.com/forums/windowsapps/en-US/f5294fcb-f4b3-4b19-9bda-f49c6a38b327/marketplace-edge-service-query
2) You could add a specific unique keyword to all your apps and use the MarketplaceSearchTask, as suggested here by Matt.
Personally, I'd go with #2 because:
you never know when the Marketplace Edge Service will change
1 is not technically supported by Microsoft
you won't have to replicate the page you're trying to display
Of course, there's also nothing stopping you from creating your own "Apps by X" page for your app and maintain it yourself manually.
Best of luck!

Is it possible to access a cell phone's contacts from a web app? [duplicate]

This question already has an answer here:
Get iPhone address book contacts into a mobile web app?
(1 answer)
Closed 9 years ago.
Let's say I'm writing an web app that needs to be able to access the contacts in user's phone in order to perform a function, like finding other users of the web app. Similar in nature to how you can find other users of Snapchat on your phone just by letting snapchat access your contacts and march the phone numbers with other snapchat users. Is this possible in a web app? How could I go about implementing it?
Depends for example Windows phone store contacts on your live or hotmail account or android usually on gmail. So if the user login with this information on your site then you can.
see http://msdn.microsoft.com/en-us/library/live/hh826530 for a microsoft example. for a wp example
see https://developers.google.com/google-apps/contacts/v3/?csw=1 for a gmail example.
No, but you can create a phonegap application to publish the phone contact to server.
Apple makes it pretty difficult now days to access any of the phones information(phone number, etc) from an app. You could make it possible in your app to manually get the contacts and then push them to your web app. Might get blocked from the apple store though for trying to do this. Here is an example for iOS
ABAddressBookRef addressBook = ABAddressBookCreate( );
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople( addressBook );
CFIndex nPeople = ABAddressBookGetPersonCount( addressBook );
for ( int i = 0; i < nPeople; i++ )
{
ABRecordRef ref = CFArrayGetValueAtIndex( allPeople, i );
...
}

Get Localized Names of Installed Windows Store Apps in Windows 8

I want to populate a ListBox with the localized display names of all the installed Windows Store apps in a Windows 8 desktop app. I tried this:
string Apps = Interaction.Environ("ProgramFiles") + "\\WindowsApps";
foreach ( App in IO.Directory.GetDirectories(Apps)) {
XmlDocument xml = new XmlDocument();
xml.LoadXml(My.Computer.FileSystem.ReadAllText(App + "\\AppxManifest.xml"));
lbApps.Items.Add(xml.GetElementsByTagName("DisplayName")(0).InnerText);
}
But it adds up ms-resource strings and default apps that are uninstalled.
EDIT: I found that all the installed apps have their shortcuts in %LocalAppData%\Microsoft\Windows\Application Shortcuts but those shortcuts don't have the localized name and are non-functional when opened.
Instead of parsing the AppxManifest files directly, use the PackageManager class.
On MSDN, there are quite a few samples that demonstrate how to gather a variety of content about installed application packages, including the Enumerate app packages by user SID sample.
Did you try that: http://marcominerva.wordpress.com/2012/12/17/localizing-app-name-in-windows-store-apps/
If you set correctly the AppPackage Name on the AppDevCenter, your appx on the client side will return you the localized name.
I don't think that There are Windows Runtime APIs which can expose this particular information back to the app. The owner of app is responsible to providing the information to the Appx Manifest in the first place. whatever you can take a look there-[http://msdn.microsoft.com/en-us/library/Hh446622 ] hope something can be useful for you.

Categories