Went through interesting experience in implementing the adcontrol in Windows Phone 7 and I thought I will share it here.
First go and register your application in
This site gives you the following steps
- Register mobile application
- Create application ad unit
- Download the Microsoft Advertising SDK for Windows Phone 7
- Integrate the Microsoft Advertising SDK for Windows Phone 7 into your application.
- Manage your existing applications and ad units
In the XAML insert the ad control
<StackPanel Grid.Row="5" x:Name="SP_ADControl" Visibility="Visible" >
<ad:AdControl RotationEnabled="True" AdModel="Contextual" Width="450" Height="80"
AdUnitId="your adunit id" ApplicationId="your application id" />
<!--<ad:AdControl Width="450" Height="80"
AdUnitId="TextAd" ApplicationId="test_client" />-->
</StackPanel>
In my application Grid.Row=”5” is the bottom portion of the screen. Do not forget to pu your own ApplicationID and AdUnitId. The commented out portion is what you can use to test the app without getting an app id from the pub center.
In the Xaml.cs file put the following in the code right after InitializeComponent();
if (!CheckIsTrial())
{
SP_ADControl.Visibility = Visibility.Collapsed;
}
else
{
// Show_Buy_Now_Page();
SP_ADControl.Visibility = Visibility.Visible;
AdControl.TestMode = false;
}
Add this method to the code
private bool CheckIsTrial()
{
#if DEBUG
MessageBoxResult result = MessageBox.Show
("CLICK OK TO SIMULATE FULL LICENSE", "BUY NOW!", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
return false;
}
else
{
return true;
}
#else
return licenseInfo.IsTrial();
#endif
}
This would help to test the app in the debug mode by showing you a dialog to test the ap. Check reference 5 given below.
The most interesting line of code is AdControl.TestMode = false; This is required because the Adcontrol.TestMode default value is True! Check reference 1 and 2 on this.
Do not forget to submit the release version to the marketplace.
References
This is one of the amazing post.This is one of the nice collection.I like this post.
ReplyDeleteAndroid app developers
Windows Phone Development
ReplyDeletemay be the latest smart phone platform, but it has already taken significant market share and poses a big aggressive threat to iPhone, Android, and BlackBerry.