locked
how to implement ads removal button in my html/JS app ?

    Question

  • i had a game app built using html5/JS , now i had integrated ads in it, i also want to implement an "ad removal" button so that when user don't want ads & clicks on the button then the app must prompt user to pay ***$ to remove ads, how can i implement this, please provide example code with detailed explanation.
    Monday, May 26, 2014 5:31 AM

Answers

  • Hi kranthi88,

    Kind of in-app purchase?  Take a look at this one: Enable in-app purchases from your app.

    If your user pay money for some of the app features, they will get receipts, see this for more information: Using receipts to verify purchases.

    For the technical party, you can simply use document.getElementById() to target your ad control and remove it from your page, that's easy.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, May 26, 2014 11:39 AM
    Moderator
  • You have a API to do this instead of directly access that file.

    Read the first link I suggested, LicenseInformation class contains all the information that you may need.

    Use following code to detect if your client has purchased the feature.

    licenseInformation.productLicenses.lookup("featureName").isActive

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, May 28, 2014 5:38 AM
    Moderator
  • Hi Kranthi88,

    Perhaps you should go through the sample: http://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a to find out which part you are missing.

    Besides, your code snippet looks correct, but I don't know the other parts, I would suggest you follow the sample to see if it can help you.

    Note  When using the simulation, the initial licensing state of the app is described in  WindowsStoreProxy.xml. CurrentAppSimulator method that alter the license state, for example by buying a license or handling an in-app purchase, only update the license state of the object in memory. The contents of WindowsStoreProxy.xml are not changed. When the app starts again, the license state  reverts to what is described in WindowsStoreProxy.xml.

    Can you double check if you have this file exist or did you load the license information before you using the CurrentAppSimulator?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.



    Tuesday, June 10, 2014 2:43 AM
    Moderator
  • Yes, of course, for Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by kranthi88 Friday, July 25, 2014 6:47 AM
    Friday, June 13, 2014 5:00 AM
    Moderator

All replies

  • Hi kranthi88,

    Kind of in-app purchase?  Take a look at this one: Enable in-app purchases from your app.

    If your user pay money for some of the app features, they will get receipts, see this for more information: Using receipts to verify purchases.

    For the technical party, you can simply use document.getElementById() to target your ad control and remove it from your page, that's easy.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, May 26, 2014 11:39 AM
    Moderator
  • thanx jamles, where can i find a model WindowsStoreProxy.xml file which describes in-app purchases ??
    Tuesday, May 27, 2014 2:31 PM
  • You have a API to do this instead of directly access that file.

    Read the first link I suggested, LicenseInformation class contains all the information that you may need.

    Use following code to detect if your client has purchased the feature.

    licenseInformation.productLicenses.lookup("featureName").isActive

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, May 28, 2014 5:38 AM
    Moderator
  • hii jamles , i implemented the following logic

    function check(){

    var currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
                var info = currentApp.licenseInformation;
                if (info.productLicenses.lookup("give").isActive) {
                    document.getElementById("myad1").removeChild(this);
                }
                else {

                }

    };

    but i am not getting any prompt to buy after clicking the purchase button(button consists of onclick="check()") 


    • Edited by kranthi88 Sunday, June 08, 2014 3:47 PM
    Sunday, June 08, 2014 3:37 PM
  • Hi Kranthi88,

    Perhaps you should go through the sample: http://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a to find out which part you are missing.

    Besides, your code snippet looks correct, but I don't know the other parts, I would suggest you follow the sample to see if it can help you.

    Note  When using the simulation, the initial licensing state of the app is described in  WindowsStoreProxy.xml. CurrentAppSimulator method that alter the license state, for example by buying a license or handling an in-app purchase, only update the license state of the object in memory. The contents of WindowsStoreProxy.xml are not changed. When the app starts again, the license state  reverts to what is described in WindowsStoreProxy.xml.

    Can you double check if you have this file exist or did you load the license information before you using the CurrentAppSimulator?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.



    Tuesday, June 10, 2014 2:43 AM
    Moderator
  • can you please provide me the link to visual studio 2012 app sample as i am developing the app for windows 8.
    Friday, June 13, 2014 3:22 AM
  • Yes, of course, for Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by kranthi88 Friday, July 25, 2014 6:47 AM
    Friday, June 13, 2014 5:00 AM
    Moderator