Following the post C# – ASP.NET Web API and ASP.NET Identity, I would like to show how we can consume a REST web service authenticated by ASP.NET Identity within Android. In this post, we’ll repeat the steps we’ve done before in .NET client but now with Java and Android. If you follow my posts before in Android section, you must be very familiar with consuming ASP.NET Web API service. We’ll use same technique again, no big deal, however I’ll introduce some new functions in JSONHttpClient class for communication with ASP.NET Identity.
We got to know with Google, Flickr and Twitter API service in some of my previous posts. All these provide us an authentication scheme so that we can authenticate ourselves and get permissions to 3rd party resources. We have also created our own REST web services by using ASP.NET Web API for publishing data to our clients. However, until now, our web services are all simply public to everyone. Everyone can use them, even our competitors (if there’s any) That’s not good and I also received questions if a web service can be protected by using authentication. So in this post I would like to make an introduction about new technology of Microsoft : The ASP.NET Identity. We’ll build a very simple REST web service with ASP.NET Web API and ASP.NET Identity from Visual Studio template and try to access it from a .NET client.
The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems. It includes profile support, OAuth integration, works with OWIN, and is included with the ASP.NET templates shipped with Visual Studio 2013.
Handling asynchronously is a ‘must’ for all mobile applications when executing any long time operation. For example, in Android, when a network operation is going to be called, it has to be executed on other thread (not UI thread). If the developers try to run a network operation on UI thread, Android OS will force the app to stop with an exception of android.os.NetworkOnMainThreadException. As usual, the developers will put long time operation in a AsyncTask (or a Thread) and let it run. I also introduced this class in many Android posts before. However I have only one AsyncTask running at a time in all of examples. A reader asked me if I can create a list of AsyncTask and execute them at the same time. Something likes Parallel Computing? The answer is ‘Yes, of course’. We can do that in Android. Therefore, in this post, I would like to show how I simulate a multi-threading case with AsyncTask and some experimental cases for comparison between native Java and Android Java in Parallel Computing
In my recent posts, I hosted source code in Bitbucket. Bitbucket is a free code decentralized version control system (DVCS) hosting site for Git and Mercurial. In comparison to GitHub, Bitbucket allows us to host unlimited private repository for free – GitHub not. In Bitbucket, we can also integrate with other great Atlassian products for managing our development with a hosted wiki and issue tracker. Because I will host my code there in future as well as moving slowly all available .zip code files from my site to Bitbucket, I would like to write a short instruction so that you know how to check out or download the code. However I won’t go into details how Mercurial works and how great the products of Atlassian are. The topic of this blog post is very limited only in source code download section, no commit and everything else.
Publishing core data through web service is always a work-intensive progress because we have to build up a web server, define service interface, make data access layer and implement user management. It has never been easy and always requires advanced knowledge. The resources of developers have to be distributed not only for client but also for server. Therefore the cost gets more. Moreover because of strong growth in market of smartphone and table running on different operating systems, the developers are put into a challenge to make a universal web service which can be easily consumed in all platforms. In my previous posts, such as How to call ASP.Net Web API service from Android? or Android – Media player and ASP.NET Web Api, we are able to build up a universal REST web service which can be consumed in all platforms supporting HTTP protocols.
I think, as developers, all of us want to write less code but still keep the code structure clean and clear as possible. When I develop app in Android, I always miss MVVM (WPF in Visual Studio) where I can bind control to event easily. Android makes me ‘bored’ when I have to look up each control with findViewById() and then initialize them so that I can use them later. Even though that the problem with findViewById() can be solved with Roboguice, but I still have to write the code for registering event such as click, long click,… It’s really boring and I want to have less code for that task. I need something ‘clean and clear’. Therefore in this post, I would like to introduce AndroidAnnotations, a framework for helping us keeping our code thin and healthy.
Bugs are always the most annoyed things for developer. It’s a dream (which never comes true) that a software runs without any problem at client’s site. There are always some points that developers have to improve after deployment. The more time developers invest for testing, the better the software is and the less annoyance developers have. I made many examples of Android development which are small apps and illustrate how a point of interest works. As a demo, I didn’t care too much about if there is a bug in app code because it isn’t a complete application. However if we want to make something that can be sold to customers, we have to be sure that our software should be reliable as it could be. Therefore in this post I would like to discuss some simple basic tests in Android development. We will learn how to write a logical unit test with JUnit, an integration unit test with test classes from Android and some advanced test cases with Roboguice, Robolectric and Mockito.
Last month I’ve a chance to develop an app using Sqlite and Entity Framework Code First. Before I started with this project, I thought everything will be easy because Sqlite and Entity Framework are both popular framework. Maybe I just need to install some nuget packages and it will work like a charm. But… yes, there is always a ‘but’ later, it’s just not so easy. Especially when I usually work with NHibernate than Entity Framework. The installation doesn’t complete his job when configuring the .config file (or maybe it just happens for me or does the author do it with intentionally?) and the Migration for Sqlite Entity Framework Code First is not supported (please correct me if I’m wrong). There are, of course, commercial products for Sqlite Migration but I prefer an open source framework or something free :). So in this post I would like to write down the steps required when starting a project for Sqlite Entity Framework Code First and how I make my own simple Migration engine.