Jimmy Engström's blog

Jimmy Engström


Getting started with Xamarin and Samsung Gear/Galaxy

2019-07-30 06:00:00 +0000

A couple of years ago I bought a Samsung Gear S3 watch (now rebranded as Samsung Galaxy Watch).
It was one feature in particular that I thought was the most important one, I should be able to develop for it.
I had heard that Xamarin was working on Tizen templates so the choice was easy.
It took a couple of years until Xamarin support for the watch came out and by then I had other ongoing development projects.
But I recently decided to revisit this and see how hard it would be to develop a simple Hello World application, it wasn't as straight forward as I would have hoped, and I decided to write this post to help others get started.

Getting Visual Studio up and running

I like to run the latest stuff so I'm running Visual Studio 2019 Preview at the time of writing.
Make sure you have Mobile development with .NET installed (if not run Visual Studio installer again and add it)

Tizen SDK

To get access to all the templates you need to install the Tizen SDK, Visual Studio will do this for you when you install the
Tizen Extension and you have to install Java JRE 8 (later versions won't work).
Download and install Java SE Runtime Environment 8 (you'll have to create an Oracle account if you don't have one)
1. Start Visual Studio
2. Choose the menu item Extensions and then Manage extensions
3. Search for "Visual Studio Tools for Tizen" and click download

4. Restart Visual Studio

Now you should have a menu Tools ->Tizen
5. Start Tools -> Tizen -> Tizen Package Manager

This will start the installation of the Tizen SDK.
6. Click Install new Tizen SDK
7. Create and browse to an empty folder where you want your SDK to be installed.

8. When the installation is done open Tools -> Tizen -> Tizen Package Manager again (if it didn't start)
9. I have a Samsung Gear S3 running Tizen So I want to install 4.0 Wearable
Click Install to the right of 4.0 Wearable

10. We also need Samsung Certificate Extension which is located under Extension SDK

Now the Tizen SDK is installed

Setting up developer mode on your watch

Time to get the watch into developer mode.
1. On your watch go to settings
2. Go to About watch

3. Go to software version

4. Find software version and tap it 5 times


Setting up WIFI

The easiest way during development is probably to use the emulator, but I want my app in my watch straight away.
1. On you watch go to Setting s
2. Select Connections
3. Turn Off Bluetooth

4. Turn on WIFI and connect to your WIFI network

5. When you connect you will also be able to see your IP number if you scroll down.
Take a note of it we will use it later.
Remember having WIFI tuned on will drain your battery so make sure you have a charger near by.

Putting it together

Ok we have a developer unlocked and WIFI connected watch and we have Visual Studio all set up, let's put it together.
1. Go back to Visual Studio
2. Click Tools -> Tizen -> Tizen Device Manager

3. Click the Remote Device Manager button
4. Click the add button

5. Enter your information and click add

6. Click the Connection button (if this doesn't work, restart your watch)



Your first app

Now we have a connection to our watch, let's write our first app.
1. In Visual Studio, create a new project use the template Tizen Wearable Xaml App
2. In the solution explorer select MainPage.xaml
3. Look for "Welcome to Xamarin.Forms!" and change it to something else "Hello World from Tizen".
4. In the solution explorer right click on your project select properties.
5. Goto Tools->Tizen -> Tizen Certificate Manager
6. Just press ok if you don't have any previous profiles
7. Click the +
8. Choose Samsung
9. Choose Mobile/Wearable
10. Name your profile
11. Create a new author certificate

12. Enter a name and password (Our company name is Azm Dev)

13. Sign in with your Samsung Account (if you don't have one, create one)
14. Create a new Distributor certificate

15. Close Tizen Certificate Manager
16. Goto tools -> Options -> Tizen -> Certification

Make sure "Sign the .TPK file using the following option" is checked
It should find your profile automatically
17. Click OK
18. Check the deployment is your watch
19. Now press Ctrl + F5 (Run without debugging)
20. Check your watch you now have "MyApp" (or the name you used) installed.

As I mentioned I am using Visual Studio 2019 Preview, and it is missing the important "use preview framework" checkbox.
After many hours of debugging I came to the conclusion that you cannot run Visual Studio 2019 Preview and have .NET Core 3 preview SDKs installed, that will make the apps break.
So I uninstalled the .NET Core 3 SDKs and things started to work.

Hope this post has helped you and please let me know if I missed something or if I can help on any other way.
Helpful links

Pluralization for Entity Framework Core Nuget

2018-04-10 08:00:00 +0000

In one of the projects I work on we use database first, but with EF core the class names was terrible, no pluralization, no singularization.
See previous post

I wanted to simplify this more so I created a nuget package so now the only thing you have to do is:

  1. Add the nuget package
  2. Add a class (Name suggestion:PluralizeDesignTimeServices.cs)
  3. Run dotnet ef scaffold…… and everything will be named correctly =)

If some translations are missing, please do a PR or contact me and I will add them.

Pluralization for Entity Framework Core

2018-01-04 08:00:00 +0000

I recently started working with .NET Core and I didn’t like that Microsoft removed the automatic pluralization/singularization of classes and collection in Entity Framework Core. They did however give us the opportunity to hook in our own. This is talked about in this StackOverflow post

What you need to do is to add a couple of files to your Entity Framework Core project.

I created a folder named “Pluralize” and added a PluralizationService. I choose to modify the one Microsoft provided in previous versions of Entity Framework found here.
You can of course just create your own. These are the files I use:

This will automatically register MyPluralizer and it will be used the next time you update your Entity Framework model.

Hope this helps you and if you have any feedback, please contact me.

Setting up source control for a HoloLens Unity project

2016-09-19 08:00:00 +0000

Don't source control generated files

When source controlling your Unity HoloLens project there is no reason to save the generated code since it is generated =)
Unity won't replace some of the generated files so if you for example change icons/tiles in the Unity project, those part will not be replaced when generating the code again.
A good practice is to export to new folders every time.


There are only a couple of folders worth adding to source control.
When setting up your project for the first time, just add the .gitignore file from here:
That way only the important files will be controlled.
You can also do this when creating a new project on GitHub.

Setting up your project

Go to Edit -> Project Settings -> Editor
To make source control work hassle free, you should make sure version control has visible meta files (or hidden meta files, if you don't want to see them in Windows Explorer).
It will add a meta file for each asset in you project, this will make sure that only the asset and the meta files gets tagged as changed if you change an asset, otherwise the whole folder would be tagged as changed.
Also make sure Asset serialization -> Mode is set to "Force Text" this will make your source control handle diffs (text is easier to handle than binary-files.
Using the Hololens toolkit http://www.apeoholic.se/hololens/2016/07/27/setting-up-a-hololens-unity-project.html will change these settings for you.

Bluetooth && Azure IoT hub == IoT - Or how to rule billions of devices

2016-09-10 10:00:00 +0000

This is my presentation from NDC Oslo 2016. NDC was fantastic, really good conference for both speakers and attendees, I hope to come back next year.

Bluetooth && Azure IoT hub == IoT - Or how to rule billions of devices - Jimmy Engström from NDC Conferences on Vimeo.

The market totally explodes with new gadgets that can connect to tablets, pc’s and phones. In 2015 alone there were 3 billion Bluetooth devices manufactured. In this session I will show how you can take advantage of that and how to communicate with devices that are Bluetooth enabled. I will also show how to figure out undocumented devices and how to use Azure IoT hub to turn them into IoT devices.