Posts

Showing posts from November, 2016

Differences between Internal and External Folders in Xamarin.Android

Differences between Internal and External Folders in Xamarin.Android and Xamarin.Forms When using Xamarin.Forms and Xamarin.Android, chances are that you had at one point of time to access a local file. Whether it is an image or a text file or even a local sqlite database, accessing a file from a Xamarin.Android project can be confusing. Today I will show you how you can get the absolute path of the different folders available in Xamarin.Android and we will see how we can get the paths from Xamarin.Forms. This post is composed 3 parts: 1. Internal folder 2. Public and private external folders 3. Access folder paths from Xamarin.Forms 1. Internal folder The internal folder is a folder specific to your application. It can only be access within your application and no other applications can touch the files within that folder. You can get it using the following: Android.App.Application.Context.FilesDir.AbsolutePath The path looks something like that: /data/user/0/com.kimserey.m

Why I created Baskee?

Image
Why I created Baskee? Few days ago, I released my first Android app Baskee built with Xamarin and F# . https://www.kimsereylam.com/baskee In this post, I would like to share with you the most common questions my friends asked me and I hope it will help you understand better why Baskee is useful for you! This post answers the following questions: 1. Where did the idea come from? 2. What are the problems Baskee solves? 3. Is Baskee free? 4. How many people worked on it? 5. What stack is it built on? 6. If you had one advice for new developers to start what would it be? 1. Where did the idea come from? I was walking at the supermarket and saw Nescafe coffee tin selling at 6 pounds. I am a big coffee consumer so I regularly buy coffee and I knew other days I did no pay for 6 pounds but I couldn’t remember how much I used to pay and even in which shop it was cheaper. I tried to check online but there was no network at the supermarket. So I didn’t get it and continue to shop. B

Fix adb server is out of date killing... Android

Fix adb server is out of date killing... Last week I showed you how to fix the error adb server version doesn't match... with Xamarin.Android - https://kimsereyblog.blogspot.co.uk/2016/11/fix-installfailed-error-adb-server.html when trying to deploy an application built in Xamarin.Studio to a Genymotion VM. This was caused by two different versions of ADB being installed on the machine. One installed during Xamarin installation and another one installed separately. The solution was to set the ADB path in the options of Genymotion. I thought all was good but turns out there was another issue. 1. Problem When running adb shell , I had the following error in bash: adb server is out of date killing... 2. Solution Again the problem was due to my machine having two adb versions and the adb location in $PATH was the wrong one. In order to check verify that, I ran echo $PATH and saw that the path was incorrect. In order to rectify that, I modified the ~/.bash_profile which is

How to use the Snackbar API in Xamarin.Android and Xamarin.Forms

Image
Use Android Snackbar for your Xamarin Android project from Xamarin Forms The Snackbar API is a sleek way to provide notifications in Android. Here’s how it look like: You might have noticed the usage of it in applications that you use daily like Chrome, get the notification that the tab was closed. This is the snackbar. Today we will see how to use the snack bar api with Xamarin Android and how we can call it from our Xamarin Forms project. This post is composed by 3 parts: 1. When is the snackbar useful 2. Implement the snackbar api 2. Call it from Xamarin.Forms 1. When is the Snackbar useful The snackbar can be use to notify the user that something had happen. You would pass it a message which would popup for few seconds to acknowledge the user action. Another useful scenario for the snackbar is to provide an instant non obstrusive way to rectify an error by providing an action button on the right . The most common action is the undo action which allows the user to rectify

Fix INSTALL_FAILED error - adb server version doesn't match in Xamarin.Android

Fix INSTALL_FAILED adb server version doesn’t match Xamarin.Android Today I would like to share with you how you can fix the following problem: INSTALL_FAILED /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets: Warning: error: could not install *smartsocket* listener: Address already in use ADB server didn't ACK * failed to start daemon * error: cannot connect to daemon List of devices attached adb server version (32) doesn't match this client (36); killing... 1. Problem You might be running two different ADB and the versions collide. 2. Solution Verify the ADB version used by Xamarin: About Xamarin > Show details > Android SDK: [PATH] Make sure the PATH is the same as the one referenced in Genymotion. Genymotion > Settings > ADB > Use custom Android SDK tools > Put PATH in Android SDK This means that the adb used by Xamarin Studio to perform all deployment commands will be the same as the dae

How to fix Xamarin Android app instantly closing with error after deployment

Image
Xamarin.Android app instantly closing with error after deployment Last week I had an issue suddenly after updating Xamarin.Android and downloading the latest Android sdk 24. My application kept closing instantely after being deployed showing the following error: Unfortunately, [App name] has stopped. I looked online and all I found was answers which recommended to uninstall the app either through the Android settings or using adb uninstall <package name> , clean and rebuild but nothing did it . It was still crashing. 1. Scoping the issue I wasn’t sure what was going on until I remembered that I could access the logs via adb logcat . After inspecting the logs, I saw the following error message: AndroidRuntime: java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_24 or Xamarin.Android.Platform! It was that it couldn’t find ApiLevel_24 but my manifest was configure

Build your own Line chart for Xamarin.Forms (Part 2)

Image
Build your own Line chart (Part 2) Last week we saw how we could use custom renderers with boxview to draw via the canvas api https://kimsereyblog.blogspot.co.uk/2016/10/build-your-own-line-chart-for.html . Today I will go through the steps to draw a line chart supporting markers. The line chart is very simple and has only one objective, give a rough indication of the current trend of the data displayed. In order to draw the chart, we will divide the chart in four layer which we will draw one by one. Therefore this post will be composed by the three layers. Draw background and bands Draw axis and labels Draw lines and markers 1. Draw background and bands We can see the canvas as a painting canvas. When we draw something and then draw something on top of that, the last thing drawn will hide the previous one - just like as if you are painting something on top of something else. Therefore the first thing we need to draw is the background. // Draws background paint.Color = Colo