I had this problem so I thought I'd post the answer since I couldn't find the solution anywhere.
First problem: when calling CurrentApp.RequestProductPurchaseAsync() I would get "Can't find item in catalog ; We looked but can't find the item you wanted to buy" or error 805a0194.
Second problem: Couldn't find a way to get if my purchase was active or not.
Solution to problem one: go to your Package.appxmanifest and right click then hit view code. if your app was already published like mine was go to the dashboard and get the AppId from the Windows Phone dashboard->apps->YourApp->Details. Paste that id into the PhoneProductId field in the Package.appxmanifest. Now your in app purchases should work as long as you published the product in the store and product id you supplied to the method matches.
Solution to Problem 2: I used this bit of code to see if the purchase was active:
private async Task<bool> GetLicenseStatus(string id)
{
try
{
var result = await CurrentApp.GetProductReceiptAsync(id);
}
catch //user didnt buy
{
return false;
}
return true;
}
Related
I have one app that I wrote already reading from and writing to the iCloud. I am essentially using the same code in my new app to do the same thing, but for some reason it will not work, giving me the following error, "Couldn't get container configuration from the server". Let me clarify, with this new app it does puts an entry in iCloud under manage storage, but instead of being under the name of my app, it is under adhoc.
Here is the line in my info.Plist,
Here is the line from my Entitlements,plist
lastly, here is my identifier defined on the apple developer site,
I have verified and reverified that everything is pointing to the correct thing so I am baffled. Any help would be much appreciated.
EDIT I guess what it is doing is writing file to my phone, but when it goes to save data to it, it fails with this message, Here is my call to save the data.
CKRecordID recordID = new CKRecordID(strDate);
await Task.Delay(200);
// Save it to iCloud
await pvc.SaveToiCloud(newRecord);
Here is my code to save the record,
public async Task SaveToiCloud(CKRecord newRecord)
{
ThisApp.PrivateDatabase.SaveRecord(newRecord, (record, err) =>
{
Edit:
I was thinking that possibly the number of nodes I had was too many, so I took out the "dist" one you see below, but that did not help. I thought maybe that was why I was seeing module name of adhoc under icloud on my phone, but I guess I was wrong.
Old:
New:
Edit
I have been doing more digging and found that this line of code is actually the one throwing the error.
File.WriteAllText(Path.Combine(filePath.Path, name + date), "Test");
The name and date contain correct values and the path looks fine to me... I guess... Don't know actually how it should look. Here is how the file path is getting set right above this call,
NSUrl filePath = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null).Append("Documents", true);
If anyone could offer any advice, I would be most appreciative.
So, I finally figured out the issue and it works like a champ now. The issue was the case in my bundle id in my info.plist. In CloudKit the DB name was all lower case, but my bundle Id in my info.plist, had AdHoc as my last node instead of adhoc as was in the CloudKit. You might say, what does the bundle Id have to do with the iCloud name, and actually I am not really sure, but I noticed that it was taking the case of that last node from my Bundle Id, not the case specified in the iCloud definition as I have shown above. Hope this helps someone who is struggling with a similar issue Have a great day!
Hello: I've been wrestling a bit with getting my app to authenticate. I've deployed the APK to my Galaxy and the following happens: Unity game opens, "Connecting to..." dialog appears, "Google Play" green dialog appears, dialog disappears with loading indicator and then I get a "false" result.
I have the following in Start():
PlayGamesPlatform.Activate();
PlayGamesPlatform.DebugLogEnabled = true;
AuthenticateGoogle();
And the following in AuthenticateGoogle():
private bool AuthenticateGoogle()
{
isAuthorized = false;
Social.localUser.Authenticate((bool result) => {
isAuthorized = result;
if (!result)
{
GameObject.Find("errText").GetComponent<Text>().text = result.ToString();
}
});
return isAuthorized;
}
I created a new Keystore using the Unity UI, entered the password and built the .APK. I then created a new application in the Google Play Console and uploaded the .APK to it. I next created a new Game Service and linked the app, allowing it to Trust the application. I created a leaderboard. I ensured my user is in the Testing section. Lastly I copied the XML from the Get resources section under leaderboard to my Unity project and built the project, copying to my phone.
Any ideas? Any other things I can do to troubleshoot authentication versus a true/false result?
I assume that you are testing it on your android phone.
You should try adding this to your android mainfest:
<activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
You can create custom mainfest in Assets/Plugins/Android/AndroidMainfest.xml
Add yourself to testers on Google Play Console (if the app is in beta) and download it directly through google play. (not test build and run)
To track errors like this you can use a tool https://assetstore.unity.com/packages/tools/log-viewer-12047 It's simple to use and you can understand what went wrong. Hope it'll help :)
EDIT:
I'm using different method, but it shouldn't make a difference:
public bool ConnectToGoogleServices()
{
if (!isConnectedToGoogleServices)
{
{
Social.localUser.Authenticate(success =>
{
isConnectedToGoogleServices = success;
});
}
}
return isConnectedToGoogleServices;
}
I have another UWP question.
I'm trying to get all the UWP apps that I published on the MS Store, but it seems there is something wrong: I can only get the current one beeing executed, although I insert many store IDs, the ones from my apps, as suggested by MS Docs.
Here's the code (of course, in my code I insert the real IDs):
StoreContext context = StoreContext.GetDefault();
string[] productKinds = { "Application" };
List<String> filterList = new List<string>(productKinds);
string[] storeIds = { "firstID", "secondID", "thirdID" };
StoreProductQueryResult queryResult = await context.GetStoreProductsAsync(filterList, storeIds);
if (queryResult.ExtendedError == null)
{
foreach (var product in queryResult.Products)
{
// Do something with 'product'
}
}
Well, it only returns one item, the current one.
Is there a way to obtain even other store apps?
Am I doing something wrong?
Thanks a lot.
GetStoreProductsAsync is only for the products associated with the app (i.e. add-ons):
Gets Microsoft Store listing info for the specified products that are
associated with the current app.
[docs]
To solve the problem you might want to look in the direction of Microsoft Store collection API and purchase API (requires web app setup in Azure).
Other than that StoreContext class at its current state doesn't contain API to get product information about other apps and their add-ons.
I have a usb connected MSR reader and i am trying to get it by using the sample codes proveded in here. This works fine but the problem is when i add the same code to my app it doesn't work. GetDefaultAsync returns null.
private static MagneticStripeReader _reader = null;
public static async void StartRead()
{
if (await CreateDefaultMagneticStripeReaderObject())
{
....
}
}
private static async Task<bool> CreateDefaultMagneticStripeReaderObject()
{
if (_reader == null)
{
_reader = await MagneticStripeReader.GetDefaultAsync();
if (_reader == null)
return false;
}
return true;
}
My code is like above, very similer to sample but it doesnt work. Also i've added the device capability of pointOfService. So that is not the case.
I was in the exact same situation and I spent the last 5 hours, finally I know what was going on. You are missing a capability in the Package.appxmanifest
'pointOfService' is the capability you want to include. This capability does not show in the UI and therefore I could not find any difference between my broken project and Microsoft's sample project. You can not add that capability using the UI. You have to manually add it by modifying the XML file.
The sample project by Microsoft have it too
https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/MagneticStripeReader/cs/Package.appxmanifest#L53
Make sure the card reader is in HID mode and not Keyboard emulation mode. That was one of my problems.
To do this is really wonky. MagTek has a ActiveX control on their website to assist us... because ActiveX is awful, you can only use it with InternetExplorer (it won't even work with Edge.)
go here in IE: https://www.magtek.com/changemode/
Enable active X when it pops up, and you can change from hid to keyboard and back.
I have a strange problem with in-app purchase in Windows Store App.
When I upload app to the Store I see a pop-up like this:
But when I run in on my local machine, from release mode and using CurrentApp
everything seems to be OK, I see checking price in Store:
Also the funny thing is that there is no difference when I am using CurrentApp or CurrentAppSimulator.
Please tell me what am I doing wrong?
Code for checking is commonly known:
public async Task<bool> IsPurchased(string featureName)
{
var applicationInformation = CurrentApp.LicenseInformation;
if (applicationInformation.ProductLicenses[featureName].IsActive)
{
return true;
}
else
{
await CurrentApp.RequestProductPurchaseAsync(featureName);
return applicationInformation.ProductLicenses[featureName].IsActive;
}
}
I had to delete all content from bin folder, clean solution and rebuild it.
Aftere these operation everything works OK.