Xamarin: Reload an iOS CallKit call directory extension from the app

I you want to make a call directory extension for iOS, for identifying or blocking certain phone numbers, you need a way to reload the extension every time you want to add or remove from the list of phone numbers you are blocking.

To reload the extension, you can either get your users to open their phone’s settings and disable the extension and re-enable it or you can reload it programmatically from your app.

To reload the extension manually, follow this procedure:

  1. Open the iPhone’s settings
  2. Go to “Phone”
  3. Go to “Identify phone numbers”
  4. Switch your extension off, then on again

To reload the extension programmatically from your app, use this code:

Here is Apple’s documentation for the error codes :
https://developer.apple.com/reference/callkit/cxerrorcodecalldirectorymanagererror.code/

The most common one I have come across is 6, Extension Disabled.

How to create an iOS call directory extension in Xamarin for blocking thousands of phone numbers

A call directory extension is used to block or identify phone numbers on an iPhone, phone numbers the user don’t have in their contact list.

TL;DR: Because iOS app extensions have very limited resources, it is difficult to load many thousand phone numbers into the call directory without the extension crashing. This is my attempt to get around this issue.

Continue reading “How to create an iOS call directory extension in Xamarin for blocking thousands of phone numbers”

Use Subversion revision number as version number with MSBuild

(And handle revision numbers larger than 65534)

When using a system for continuous integration to automatically deploy your application, it is important to know what version of your code is deployed. This tutorial will show you how to automatically set the version number of the deployed .dll.

In a .NET project, the version number is defined in AssemblyInfo.cs, on the format 1.0.0.0. The numbers are MajorVersion.MinorVersion.Build.Revision. The two latter, build and revision numbers, should be set automatically by your CI system on each deploy.

Content of this tutorial

  • How to create an MSBuild target to automatically insert the revision number on build
  • What to do when your revision numbers are too large to use as .NET revision numbers
  • How to use Bamboo to get the latest revision number from Subversion and use this as an input parameter to MSBuild

Continue reading “Use Subversion revision number as version number with MSBuild”

How to use Bootstrap or other CSS frameworks on a small part of a page without affecting the rest of the page’s style

I’m currently working on a project where I have an AngularJS app (a form), that will be displayed on several different external websites. This means that I have to style the form to fit into several different page designs, with different existing stylesheets.

The form itself is styled using Bootstrap, one of the most commonly used front-end frameworks.

TL;DR: To style only a selected part of a website using a CSS framework, I create a container div around the app with a unique id, and then use LESS to change all the style definitions in the framework to only affect this particular id. This process is done automatically on build using .NET MVCs bundling framework.

Continue reading “How to use Bootstrap or other CSS frameworks on a small part of a page without affecting the rest of the page’s style”

AngularJS and .NET MVC: Convert templates from html to javascript and bundle app and templates together

I am working on a project where I have an AngularJS app on my own .NET MVC website, and I will display this app on several remote websites.

TL;DR: To get the AngularJS templates to load correctly on the remote website, I needed to convert the html template files to javascript and bundle them together with the rest of the app. This article will try to explain why and how to achieve this.

Continue reading “AngularJS and .NET MVC: Convert templates from html to javascript and bundle app and templates together”