Xamarin forms get Phone language IOS does not work but work on Android - xamarin.forms

I am using xamarin forms. I am trying to get the phone language (real phone). The code gives me english while my phone is in French. when try with android phone (real phone), it works and I have french.
Here is the code :
string phoneLanguage = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
Here is the output on IOS :
en
Here is the output on android :
fr
Both phone (real phone) are in french but only IOS gives me en. I have tried with another Iphone but I still have en
Thanks for your help

iOS first looks up your user's most preferred language and sees if the language is supported by the program. You can check if your program localizations bundled (.lproj) has French files. Then you can also check whether the following key-value pairs are added in the Info.plist file of your application to set the supported languages, like this:
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>fr</string>
...
</array>
You can detect the device's current locale using the following methods:
var userLoc = NSLocale.CurrentLocale.LocaleIdentifier;
For more details you can refer to:
Localization in Xamarin.iOS | Microsoft
How iOS Determines the Language For Your App

Related

how get key/value from nsuserdefaults .plist configuration file Xamarin forms

I am working as a Xamarin forms iOS enterprise app.
We pushed config.plist (Some key-value pair) file to a real device using Mobileiron/airwatch MDM/EMM(Services). Then we deploy the Apps on iPads using MobileIron. When the app starts, the app gets Url/ credentials from config.plist that pushed by MDM.
after googling I found config.plist stored in device which in NSUserDefaults​
But I am don't know is the .plist stored in NSUserDefaults with apps bundle id or something else.
Please anybody has the same issue before writing to me how I have to implements or getting value from .plist
I think you will find the details from your question on page 69-70 of Apple's MDM-Protocol-Reference. The MDM server deploys these settings using a dictionary that contains an array of bundle ids, with the settings for each app within their key. Because of how sandboxing works, your app just has to retrieve the com.apple.configuration.managed key to get its settings.
A great resource is https://www.appconfig.org/ios/

Xamarin - No resource Id shown or available in image properties

I am trying to embed an image in Xamarin and was expecting to see a resource Id appear in the properties of the image. It seems to be a problem that I cannot find an answer for. I have updated VS, JDK to 64 bit, updated Xamarin, cleaned rebuilt, restarted. I'm using the latest API (API 27 8.1)
I have checked the Xamarin forum and the VS forums and there is no answer available. In my code-behind I am writing the following:
bgImage.Source = ImageSource.FromResource("FoodSnapApps.Images.steps.jpg");
Obviously it wont work as the resource has no reference.
As always, any help will be greatly appreciated.
As stated here, in Xamarin forms local images must be loaded in the platform specific projects:
Image files can be added to each application project and referenced from Xamarin.Forms shared code. To use a single image across all apps, the same filename must be used on every platform, and it should be a valid Android resource name (ie. only lowercase letters, numerals, the underscore, and the period are allowed).
iOS - The preferred way to manage and support images since iOS 9 is to use Asset Catalog Image Sets, which should contain all of the versions of an image that are necessary to support various devices and scale factors for an application. For more information, see Adding Images to an Asset Catalog Image Set.
Android - Place images in the Resources/drawable directory with Build Action: AndroidResource. High- and low-DPI versions of an image can also be supplied (in appropriately named Resources subdirectories such as drawable-ldpi, drawable-hdpi, and drawable-xhdpi).
Windows Phone - Place images in the application's root directory with Build Action: Content.
Universal Windows Platform (UWP) - Place images in the application's root directory with Build Action: Content.
Then you can access them as follow:
In XAML: <Image Source="waterfront.jpg" />
In C#: var image = new Image { Source = "waterfront.jpg" };
I suggest you to read all that page of documentation to proper handling images in your Xamarin forms project.
HIH
I know it's an old question, but for people who may reach this page on future, code below works for me:
bgImage.Source="resource://FoodSnapApps.Images.steps.jpg"

Sign in with LinkedIn, SDK for Android, Sample application error

I would like to try feature "integrate Sign In with LinkedIn".
I follow instructions and i download latest version ( Mobile SDK for Android 1.1.4) from:
https://developer.linkedin.com/downloads#androidsdk
Then i import and build project into Android Studio.
When i execute SDK for Android Sample App i obtain this screenshot:
http://i64.tinypic.com/35hpvyb.png
Any help will be appreciated. Greetings
I answer myself.
The problem was i didn´t follow (ignore) step "Associate your Android app with your LinkedIn app"
https://developer.linkedin.com/docs/android-sdk
1) Create an application
2) Signing Your Application, generating a debug key hash value.
3) Configure the values: In the Mobile->Android Settings->"Package Name & Package Hash" section of your LinkedIn application's configuration, add your application's package and hash values
That´s all. Sorry for such a dumb question... ;)

ODK, Formhub, Enketo pulldata command

I am attempting to create an xls form that uses the "pulldata" command to reference data uploaded in a csv document. ODK provides an example of this here: link.
When I try to upload their example to a website that allows for the hosting of xlsforms via Enketo (Formhub.org or Ona.io) I get the message "Function "{}pulldata" does not exist." However, Ona.io claims that they DO have this functionality in their blog: link 2.
It seems that "pulldata" and the related "search" commands are not supported by Enketo. I imagine they do work in ODK Collect on Android devices.
I would like to use these functions on web forms (not Android devices). Is there a way to get them to work in Enketo or an alternative for hosting xlsforms / x forms online?
Many thanks
Update:
Pulldata() is now supported in the new Enketo app (Enketo Express). It just requires the form to be transformed with a version of pyxform (XLSForm) after September 5th 2015.

Make QR Code to Open Android Application? [duplicate]

2 questions about using a QR code in an Android device:
1. Is it possible to launch a native Android application from a QR code? Maybe by some configured URI schema?
2. Another option which might be useful for me is to have a QR code scanner inside my own app. Will it be possible for me to somehow include a different app that scans QR codes inside my app? Or will I have to implement the scanning myself?
Thanks
To scan barcodes in Android by Intent, see https://github.com/zxing/zxing/wiki/Scanning-Via-Intent
To trigger an app from a QR code, yes, you need to register the app to handle the particular custom URL scheme. This is how the same app can respond to clicks on the web: https://github.com/zxing/zxing/wiki/Scanning-From-Web-Pages
Look at how it registers to handle URLs here: https://github.com/zxing/zxing/blob/master/android/AndroidManifest.xml
1.to use a configured schema you can check this post
Launch custom android application from android browser
Then the you could QR code this scheme just like market://
2. You could use Bar code scanner app and use below code to launch or you could even integrate the zxing library to scan yourself.
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("SCAN_MODE",
"ONE_D_MODE,QR_CODE_MODE,PRODUCT_MODE,DATA_MATRIX_MODE");
startActivityForResult(intent, 0);

Resources