6 Most Important Factors for a Successful
Mobile App!
Every precaution that you take in the development
process will help you gain new customers. Consider these 6
factors before heading for mobile app development.
QSS is a full cycle development company that takes care of
your business app right from ideation, prototyping, to
rapidly launching an MVP in the market.
Agile
QSS works with Agile Methodology so as to provide the utmost
visibility and transparency to our customers over projects
controlling & monitoring timelines, risks and their
mitigation strategies.
Dev Ops
We bring your business, development and operation teams
together & automated processes to streamline your IT
department. Our customized DevOps services can be used for
individual customers to large-scale enterprise products.
MVP
QSS uses Smart Approach To Product Building via MVP! In our
journey of 10 years, we have rapidly built over hundreds of
MVPs and scaled startups to new heights.
Published on Nov 14 2018
How to use GeoLocator in Xamarin.Forms?
Abstract
These days every application wants to access your location. It is a very basic requirement but the question is how to achieve this. Sometimes, we use GeoLocation but get stuck in issues regarding permissions. Accessing Location is not a difficult task but we need to be very careful in giving permissions. This article contains everything by which you can get the latitude and longitude of the location by providing desired permissions. By using latitude/longitude, we can also obtain an address.
Introduction
Xamarin.Forms provide the readymade plugin for accessing the location of your device from both platforms(Android and iOS). We need to add that plugin and write a single function for using it. This article will also demonstrate how to add permissions for Android and iOS. I have added the screenshots using MacBook but you will find everything same on Windows.
Steps for using GeoLocator:
1) Create a new cross-platform app in Visual Studio.
2) For using GeoLocator, you need to add the package Xam.Plugin.GeoLocator in your project as shown below:After clicking on Add packages, It will open a window from which you have to select Xam.Plugin.GeoLocator package.
3) Before accessing the GPS in Android or iOS, we need to add Location permission.
Android:
For Adding the Location permission in Android right click on your project and then go to the options(or properties). In Required permissions check AccessFineLocation and AccessCoarseLocation.
Now you need to add some code in MainActivity as given below.
Adding Privacy-Location Usage Description and Location When In Use Usage Description in the source of info.plist. Add one line code in FinishedLaunching of AppDelegate. This will be used for initializing the map.
global::Xamarin.FormsMaps.Init();
4) Now we need to add a XAML and write the code for displaying the location. We are adding a button and label. After clicking that button, the label will display your location.
<ContentPage.Content>
<StackLayout Padding="0,20,0,0" VerticalOptions="Center" HorizontalOptions="Center">
<Label Text="Click Below To Get Location" TextColor="Blue" HorizontalOptions="Center"/>
<Button Text="Find Location" Clicked="OnButtonClicked" BackgroundColor="Azure"
HorizontalOptions="CenterAndExpand"/>
<Label x:Name="addressLabel" TextColor="Navy" Margin="20,20,0,0" />
</StackLayout>
</ContentPage.Content>
5) Now In the corresponding cs file, we need to write the button click event. Firstly, you need to add namespace.
using Xamarin.Forms.Maps; Create an object of GeoCoder in your cs file:
Geocoder geoCoder = new Geocoder();
async void OnButtonClicked(object sender, EventArgs e)
{
try
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(2));
double? latitude = Convert.ToDouble(position.Latitude);
double? longitude = Convert.ToDouble(position.Longitude);
if (latitude != null && longitude != null)
{
var revposition = new Position(latitude.Value, longitude.Value);
var possibleAddresses = await geoCoder.GetAddressesForPositionAsync(revposition);
foreach (var address in possibleAddresses)
addressLabel.Text += address + "\n";
}
else addressLabel.Text += "error";
}
catch (Exception ex)
{
await DisplayAlert("Notification", "Unable to get GPS Location " + ex, "Ok");
}
}
6) Now run the code on both the platforms and you’ll get the output as shown below:
On Android:
On iOS:
Conclusion:
This will completely help you in showing the current device location. If you don’t want to use this plugin then you need to make a dependency service forxamarin app development
About Author:
Rashi saini is working in QSS Technosoft as a Xamarin Developer. She has a good experience in
Xamarin.Forms(PCL and Shared both) and Xamarin native. She likes to be aware with new trends in
technology.
About QSS: QSS Technosoft is leading Xamarin App Development Company developing a cross-platform mobile applications for its esteemed customers. The company has a core competency in developing and delivering Enterprise level Xamarin applications both in Native and Hybrid platforms. The Xamarin competency has experienced and dedicated team of Xamarin developers.
6 Most Important Factors for a Successful Mobile App!
Every precaution that you take in the development process will help you gain new customers. Consider these 6 factors before heading for mobile app development.
Xamarin is a software company headquartered in San Francisco, which develops tools for cross-platform application development using C#. The products are developed to allow developers to share code between different platforms in use. As an example, developers
Xamarin technology is a software development platform for mobile devices that enables you to use C# and the .NET framework to create iOS, Android, or Windows Phone apps from a single codebase. In addition, it also allows developers to share third-party
Xamarin is a perfect cross-platform tool equipped with amazing features like code re-usability, quick time-to-market, native UI, multiple platform compatibility, API access, and performance. These all features make this cross-platform app development
Mobile applications are the necessity of businesses today. However, the real challenge lies in deciding which platform best suits their business. Is it good to go for a native app individually for Android & iOS devices or choosing a cross-platform
With the introduction of the latest release of Xamarin.Forms 4.0 versions, incredible new attributes have been offered to simplify the development process of the innovative mobile apps with the use of C# programming language. The icing on the cake is, new
Abstract: This article demonstrate each and every steps required for adding font style in your app. Xamarin already contains some popular font styles but if you want to add a new font style then this article completely belongs to you. This article will help
Abstract As you know that nowadays Dynamic UI generation has become more common. Most of the e-commerce applications such as Flipkart, Amazon, etc. are using this concept. This requires creating UI dynamically on a mobile client device. With such approach,
Abstract: Demand for mobile apps has been increasing day by day. Many companies are preferring hybrid mobile app development when it specifically comes to B2B or B2E applications. For doing cross platform app development, we have many frameworks like Xamarin,
Abstract: This article provides you a basic idea of creating a Xamarin App which will run on Android and iOS. It contains each and every steps required for creating an app using visual studio for windows and macOS. Introduction: Basically, Xamarin is a
Abstract Over thousands of mobile apps are released everyday but only few of them are implemented with security features which are worthy if implemented in transactional apps .This article will give you a description of these enhanced security features that
Developing similar individual native mobile app to run on Android, iOS, and Windows need considerable time and efforts. On the contrary, developing a cross-platform native mobile app using a single framework reduces these efforts significantly. Xamarin is one
Mobile applications are on a rise! Hence developers prefer building native mobile applications that offer the fastest, most reliable and most responsive experience to users. But what next, the business now wants to have a mobile app run across major platforms
6 Most Important Factors for a Successful Mobile App!
About This eBook
This ebook will uncover the six most important factors that you should always strive to make your business mobile application a success. Targeting these factors & avoiding the simple mistakes in your mobile app will help businesses get the most out of their mobile apps.