Admob issues on Xamarin iOS apps with Admob SDK version 6.12.0 - xamarin.ios

I am currently using the Google AdMob Xamarin component (version 6.12.0 - see https://components.xamarin.com/view/googleadmob) to display DFP interstitials and banner ads (displayed at different points within a tableview) on an iOS app. When I am debugging in Visual Studio 2013 I get the following output:
<Google:HTML> You are currently using version 6.12.0 of the SDK, which doesn't
officially support iOS 8. Please consider updating your SDK to the most recent
sdk version, 6.12.2, to get iOS 8 support, including a fix for smart banner
rendering in landscape mode. The latest SDK can be downloaded from
http://goo.gl/iGzfsP. A full list of release notes is available at
https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes.
According to the Xamarin component's page, 6.12.0 does actually support iOS 8. Should I ignore the warning that I am getting? If not, how do I go about using 6.12.2 when the newest version of the component is only 6.12.0? Is it OK to stay with 6.12.0 or will it cause issues?
I have noticed that the banner ads aren't really displaying in the correct location on iOS8, they are slightly to the right and down from where they should be. Is this because of the SDK or some other change in iOS8 regarding how cells are displayed?
Below is how I display the banner ad:
public void InitialiseBanner(AdMobView property)
{
_bannerViewDelegate = new AdMobBannerViewDelegate();
_bannerView = new DFPBannerView();
float x = (CurrentWidth/2) - (AdvertWidth/2);
_bannerView.RootViewController = this;
_bannerView.BackgroundColor = UIColor.White;
_bannerView.Delegate = _bannerViewDelegate;
_bannerView.Frame = new RectangleF(x, 5, AdvertWidth, 50);
View.Frame = new RectangleF(0, 0, CurrentWidth, 50);
View.AddSubview(_bannerView);
_bannerView.AdUnitID = "/**UNITIDREMOVED**/" + property.AdAlias;
GADRequest request = GADRequest.Request;
.
.
.
_bannerView.LoadRequest(request);
View.BringSubviewToFront(_bannerView);
if (DeviceHelper.IsIos8OrGreater && RespondsToSelector(new Selector("separatorInset")))
{
_bannerView.LayoutMargins = UIEdgeInsets.Zero;
}
}

As for a normal banner, try loading your AdView Like this:
(This is my working example)
As a class level declaration, type this:
GADBannerView adView;
bool viewOnScreen = false;
// Get you own AdmobId from: http://www.google.com/ads/admob/
const string AdmobId = "<your admob id>";
Then in your viewDidLoad you can specify position of your banner and load it:
adView = new GADBannerView (size: GADAdSizeCons.Banner, origin: new PointF (0, UIScreen.MainScreen.Bounds.Height-100)) {
AdUnitID = AdmobId,
RootViewController = this
};
adView.DidReceiveAd += (sender, args) => {
if (!viewOnScreen) View.AddSubview (adView);
viewOnScreen = true;
};
adView.LoadRequest (GADRequest.Request);
I get the same error as well, but it doesn't actually matter. I also thought first that this was the issue but my setup was a bit wrong, i think that is the same for your code. In my example i just added my AdView to the MainView, but using custom cells you should be able to implement it in your UITable View. Also, have a look at the example provided in the components section. As for displaying DFP interstitials: There has to be something wrong with the setup as well, but i can't see it in the code you provided.

Related

How to show an image in the mobile application

I have a request to add the image from a stock item to the picking screen in the mobile app in Acumatica. I took a look at the Mobile Framework documentation but, there doesn't appear to be a way to show an image in the mobile app. Has anybody tried something like this?
TIA!
I don't think there is a control for ImageURL in the mobile app as of now.
However, as long as your screen holds a Header record with Files(attachments) you could still see the attachments(images) in the mobile application.
For this you can take as an example and guidance the EP301020 - Expense Receipt screen:
add screen EP301020 {
openAs = Form
add container "ClaimDetails" {
formActionsToExpand = 1
add layout "ReceiptNumberHeader" {
displayName = "ReceiptNumberHeader"
layout = "HeaderFirstAttachment"
add field "ReceiptNumber" {
forceIsDisabled = True
}
add field "Status" {
forceIsDisabled = True
}
}
add field "DetailsExpenseDetails#Description"
.....................
attachments {
imageAdjustmentPreset = Receipt
}
}
...............
}
See more details about the layout "HeaderFirstAttachment" here:
https://help.acumatica.com/(W(1))/Help?ScreenId=ShowWiki&pageid=bd31e3a8-538f-47d5-84ff-251ca3d03c43

Xamarin iOS: BarTintColor not working in iOS 15

I came across a similar issue in this post.
I tried to convert iOS native code into Xamarin.iOS C#.
iOS Native Code:
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = <your tint color>
navigationBar.standardAppearance = appearance;
navigationBar.scrollEdgeAppearance = navigationBar.standardAppearance
my own code for Xamarin.iOS C#
if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0))
{
var appearance = new UITabBarAppearance();
appearance.ConfigureWithOpaqueBackground();
appearance.BackgroundColor = UIColor.FromRGB((float)rgbColorBackground.R, (float)rgbColorBackground.G, (float)rgbColorBackground.B);
this.TabBarController.TabBar.StandardAppearance = appearance;
}
else
TabBar.BarTintColor = UIColor.FromRGB((float)rgbColorBackground.R, (float)rgbColorBackground.G, (float)rgbColorBackground.B);
However, there is no reference to "scrollEdgeAppearance" in Xamarin.iOS C#, and it seems important to add this to solve the issue. I'd be grateful if someone can give me some advice or point out my mistakes.
I did this to solve transparent tabbar in IOS 15.
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
// Color of the selected tab icon:
UITabBar.Appearance.SelectedImageTintColor = AppColors.Primary500Color.ToUIColor();
UITabBar.Appearance.BackgroundColor = AppColors.WhiteColor.ToUIColor();
if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0))
UITabBar.Appearance.ScrollEdgeAppearance = new UITabBar().StandardAppearance;
Regards Joacim

not a valid calendar for the given culture.parameter name: value

here is my scenario. i build xamarin forms app. when the user device language is English it works fine..but in Arabic language . any page he open that contains DatePicker or datetime the app crashes ..any help please.
This is a known Xamarin bug, which they unable to fix since I reported it in 2015.
In brief linker thinks that you don't need Other calendars rather than default.
Even though the project settings specify that it supports these languages.
In order to workaround it create calendars in your code. (Force linker to include them)
And call it from AppDelegate.cs or from other Famarin Forms app init method:
private static void PreventLinkerFromStrippingCommonLocalizationReferences()
{
_ = new System.Globalization.GregorianCalendar();
_ = new System.Globalization.PersianCalendar();
_ = new System.Globalization.UmAlQuraCalendar();
_ = new System.Globalization.ThaiBuddhistCalendar();
}
https://github.com/xamarin/xamarin-android/issues/2511
Try specifying a locale when using the date value from the image picker
var dateFormatter = new NSDateFormatter
{
DateFormat = _dateFormatString
};
var enLocale = new NSLocale("en_US");
dateFormatter.Locale = enLocale;
sender.Text = dateFormatter.ToString(modalPicker.DatePicker.Date);

Transition is lost when using PRISM in UWP

I am making my first steps in Universal Windows Platform (Windows 10 store apps technology). I have an application with 2 pages and use the navigation service to navigate between them. I am used to having a transition applied when navigating between pages, but now I don't see any transition.
I tried to set the content transition manually but that does not work as well:
protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
{
var shell = Shell as Frame;
shell.ContentTransitions = new TransitionCollection();
shell.ContentTransitions.Clear();
shell.ContentTransitions.Add(new ContentThemeTransition { HorizontalOffset = 300 });
this.NavigationService.Navigate(Experiences.Main, null);
return Task.FromResult<object>(null);
}
Is there any other way to configure the navigation service to apply a transition?
I found the solution for the problem. I ended up using the **EntranceThemeTransition** and it seemed to work:
shell.ContentTransitions.Add(new EntranceThemeTransition {
FromHorizontalOffset = 400,
FromVerticalOffset = 0,
IsStaggeringEnabled = true});

Android programmatically created MapView v2 is not displayed

I updated RawMapViewDemoActivity.java in the Android Google Maps v2 sample app to programmatically create a MapView but map is not displayed. I just get a blank screen.
I replaced
mMapView = (MapView) findViewById(R.id.map);
with
GoogleMapOptions options = new GoogleMapOptions();
options.camera(new CameraPosition(new LatLng(0, 0), 15, 0, 0));
mMapView = new MapView(this, options);
mMapView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
What am I doing wrong?
Have you forwarded all the livecycle methods to the new MapView?
mMapView.onCreate(savedInstanceState);
Take a look at the API Reference
Sorry - I fixed this a while ago, but forgot to post the answer.
It seems that a MapView must be placed in a layout container before it will be correctly displayed. The following snippet shows what I did to make the sample work.
LinearLayout linearLayout = new LinearLayout(this);
GoogleMapOptions options = new GoogleMapOptions();
options.camera(new CameraPosition(new LatLng(0, 0), 1, 0, 0));
mMapView = new MapView(this, options);
linearLayout.addView(mMapView);
setContentView(linearLayout);

Resources