android

Universal Application and Xamarin Development – Session

February 23, 2015 Sessions , , ,

As a part of March Singapore .NET Meetup, you can expect to learn on some of the hot topics like Client Server Code, ASP.NET MVC, Windows Universal Application Development and WPF. The detailed agenda is as per,

  • Secure Client-Server code by Lawrence Hughes
  • Basic ASP.NET MVC for beginners by Dawa Law
  • Windows Universal App
    Development by Punit Ganshani
  • Smart auto complete in WPF, by Riza
  • How to use Azure SQL Database using .NET by Riza

I will be speaking on developing Universal Applications and will cover 3 platforms – Windows 8.1, Windows Phone 8.1 and Android using Xamarin

Location:     Microsoft Singapore
Date and Time:    3 March, 7:00 PM to 9:00 PM

You can RSVP on the Meetup Event Site

Azure Mobile Services – Session

February 16, 2015 Sessions , ,

The UG leads of both Azure and SGDotNet have got together to consolidate our events, as the target audience are predominantly overlapping. As a starter, organized on 26th Feb is the meetup focusing on the most trending topics – IoT and Cloud. There will be 2 sessions

  • Programming Windows on IoT Devices by Neng Giin Yap
  • Azure Mobile Services with Cross-Platform Mobile Development by Punit Ganshani

I will be broadly covering basics of Azure Mobile Services and the architecture. As a demo, we will also cover how to create Mobile services on the Azure, consume the service from the Mobile devices using Windows Phone or Android using Xamarin or PhoneGap.

Location: Microsoft Singapore
Date and Time: 26 Feb, 2015 7:00 PM Onwards

You can RSVP for the session on Meetup Event Board

 

Xamarin, Visual Studio 2015 Preview, Android Development and Emulators

November 19, 2014 Android, Visual Studio, Xamarin , , , , ,

Well, this post is inspired to help a close friend of mine who was struggling to get Xamarin run on Visual Studio 2015 Preview and develop some Xamarin application on Android platform. So I though I will give myself a try with Xamarin on this version of Visual Studio.

Clean Start

 

I believe in clean start, so if you have any versions of Xamarin installed you should uninstall them. I had a version installed for my Visual Studio 2013 Ultimate Edition and I uninstalled Xamarin. I had to uninstall Xamarin Universal Installer, Xamarin Studio and Xamarin. Give your machine a restart to ensure no pending uninstallations exist.

You don’t need to uninstall Visual Studio 2013 or any other editions you have on your machine.

Creating your Android Project

 

Open up your Visual Studio 2015 Preview and create a new Project (File > New Project). You will see 2 different templates i.e. Android and iOS.

Select Build native Android apps in C#. Once the new project is created (takes approx. <1 min), you will be prompted with a screen from where you can download Xamarin

Since you don’t have version of Xamarin on your machine, I would recommend downloading Xamarin. If you have any subscription of Xamarin, you can use that subscription. The installer XamarinInstaller-VS2015.exe is of 1.9 MB approx. Remember to close all instances of Visual Studio before going ahead.

If you have gone through Secondary Installation on Visual Studio, probably Xamarin will detect Android SDK like,

It took 4-5 minutes for me for Xamarin Installer to download and install all required components. The official documentation of Xamarin 3.9 that supports Visual Studio 2015 is available at Documentation

After the completion of installation, your Visual Studio New Project dialog will have more templates as shown below

So let’s create a blank Android Application. For the purpose of this post, I will leave the project with default code.

Building the Android App

 

The first error on build is a resource error

Show Severity Code Description Project File Line
Error Access to the path ‘resources.apk.bk’ is denied. App1

This is typically caused when your Android compilation and Android Emulator have version incompatibility.

To resolve this, right click on Project > Project Properties. Check the Compile using Android version it should be less or equal then your Android API version.
I changed my project settings as shown below

Running the Android App on Mono Emulator

 

I opened up the Android Virtual Device Manager (Visual Studio, Tools > Android > Open Android Emulator Manager) and saw that there are only 2 Virtual Devices using platform 10 and 12 while I was using version 19.

So if you are not using anything specific to v19 (KitKat), you could downgrade your versions 12 or 10 in the project properties and use the emulator MonoForAndroid_API_12 and run the application to see something like

If you want to use v19, you need to perform some additional steps. You need to open up Android SDK Manager (Visual Studio, Tools > Android > Start Android SDK Manager) and download System Images as shown below

Once this is installed, you can create your new AVD with configuration shown below. This AVD will be stored at C:\Users\%username%\.android\avd

 

As soon as you create the AVD, Visual Studio 2015 will detect it and show in the Run option

The build may take some time, especially the installation of Mono shared runtime

Assuming that you have set the API properties correctly in Visual Studio when you build your Visual Studio solution for VS Emulator, you may hit another build error which is totally cryptic.

1>Starting emulator: VS Emulator Android Phone

1>Emulator start error: VS Emulator Android Phone

Build has been canceled.

Now this does not provide much detail but the solution to this problem lays in the fact that VS Emulator Android Phone requires Hyper-V Platform to be enabled. There are enough posts on the Internet to enable Hyper-V on Windows 8.1. This should resolve this error for you.

Once Hyper-V is installed, you can open up Hyper-V Manager. You will not see any Virtual Machines in the console but you should be good to start the build and deploy on VS Emulator Android Phone. Your application will appear as shown below

The build & deployment with VS Emulator is much faster (thanks to Hyper-V). When the application is running, you can check CPU and Memory usage in Hyper-V Manager. Note that this CPU usage and Memory for your Emulator (in this case a VM) and not for your application.

As visible in the images, the emulator supports high resolution and has been designed to even support Hi-Res. So this is much easier & elegant way of using emulator than using Mono emulators.

If you face any issues, do comment here..

5 quick steps to resolve Android Battery Drain Issues

January 20, 2014 Android , , , ,

Applicable to: Some Android Phones (incl some Galaxy variants)

This article is for those who are facing battery drain issues with some Android/Galaxy phones, especially, after upgrading to Android 4.3.  I faced this same issue and did a lot of research to find out the right fix.  This requires rooting the phone along with few tweaks and has worked for me.  This can also work for non-Galaxy phones but the names of services may differ

As a word of caution – please understand you are trying this at your own risk and responsibility of any loss of data or whatsoever.  So please take a backup of your phone.  Also rooting may void your warranty too.  The author of this article does not take any responsibility of inaccurate or partial information on this article or any loss of data or whatsoever.

Do I really need to root?  Yes, because otherwise disabling all the services becomes difficult

Here’s the fix.  Before you start, ensure that you have sufficient (hmm, let’s say 80%) juice in your battery.

Step 1 – Backup and Stat Measurement

If you have patience, download the app Battery Stats Plus and let your phone drain for a day so that you know which apps are causing the maximum drain.  Take a note of these apps

Take backup during this time using any backup application on the play store.  I used Carbon Backup for taking backup of my apps, photos and data.  You can read through this article on A-Z of Nandroid to follow more backup instructions.

Step 2 – Root the Android phone  (except Galaxy S3 LTE)

I own S3 LTE so I can suggest on rooting S3 LTE.

For other Samsung Galaxy phones, you can check this article on AndroidGeeks

For non-Galaxy phones, you can check root process at xda-developers

Step 2 – Root the phone Samsung Galaxy S3 LTE

    • Install the USB drivers from here or from Samsung’s website
    • On your phone,
      • go to Settings > About.  Tap the Build Number 7 times to enable Developer Options (that’s a key to the secret)
      • go to Settings > Developer Options.  Enable USB Debugging

  • There are several ways to root your Galaxy phone.  I used Odin3-v1.85 and CF-Auto-Root applications.  Click on the links to download them
  • Power off the phone
  • While switching it ON, press Volume Down + Home + Power button.  This will get you to Download Mode
  • Run Odin3-v1.85 as Administrator (Admin is must)
  • Now connect your Samsung Galaxy S3 LTE with your PC using USB cable.  You will see a Message ‘Added’ and a COM port in Yellow.  This means the connectivity has been established
  • Click on PDA button and select the CF-Auto-Root file (CF-Auto-Root-m3-m3zh-gti9305.tar.md5) and select Auto Reboot and F. Reset Time
  • Click on Start
  • This will push some packages to your smartphone and once the process is completed successfully you will have an application called SuperSU (Super User) on your phone

image

Step 3 – Remove the bloatware

The upgrade has pushed some services that have unfortunately caused the battery drain.  So you need to block these services.  As a super user, you can uninstall these services too.  But I will not advise doing so.  It is better to disable the services.  This means the service packages still remain on your phone (occupying some internal memory) but they are disabled from running.

    • Go to Play store and download any bloatware blocker.  I used NoBloatFree and SystemCleanUp
    • You can use TitaniumBackup to take backup of all apps on your SD card just to play safe
    • Now you will see lot of services running that offer services that you may not be interested in.  You can Freeze / Disable those services.  Remember that you do not have to Delete them, you just have to Freeze / Disable them
    • Please be sure that you do not disable any launcher application.  TouchWiz is launcher
    • My list of disabled apps.  If you are using some Speech to Text and translator services you may choose to not disable S Voice, S Translator

AllShare ControlShare Service
AllShare FileShare Service
Bubbles 1.0
ChatON
ChatOn V
DirectConnectManager
DirectShareManager
Exchange Services  (if you are not using your phone for your Office Exchange accounts)
Kies via Wifi
Nearby Service
PageBuddyNotiSvc
Phase beam
S Health
S Memo
S Note Provider
S Translator
S Voice
Samsung account
Samsung Apps
Samsung Apps Widget
Samsung Books
Samsung Calendar SyncAdapter
Samsung Cloud Data Relay
Samsung Cloud Quota
Samsung Contact SyncAdapter
Samsung Games
Samsung Hub
Samsung Link
Samsung Music
Samsung Push Service
Samsung SBrowser Bookmark SyncAdapter
Samsung SBrowser Tab SyncAdapter
Samsung SNote SyncAdapter
Samsung SyncAdapter
Samsung WatchON
SamsungHubUpdater
Share music

  • You can also disable some additional apps, if you are not using them, like weather apps, news apps, clock widgets, planner apps, etc.
  • If you face any issues after disabling any application, just go to Settings > Application Manager > Select the application > Enable
  • Disable USB Debugging so that Antivirus does not raise it as Security Alert
  • If you want to reset your root counter to 0, you can buy Triangle Away app from the Play Store

Step 4 – Preventing more juice

Now this would prevent faster battery drains but you can make it even better.  Install a battery saver like JuiceDefender or DS Battery Saver.

After doing these steps, here is the snapshot of my battery drain after full recharge with almost full working day (during work hours) –

droid-mem

Step 5 – Let me know your feedback

Well, actually there are just 4 steps.  The fifth step let’s you share your experience.

Let me know what worked and what did not by commenting.  If all worked, share it with others 🙂

Fix: Insufficient Storage Available on Android

January 11, 2012 Android

android_logo If you are using a phone or a tablet running on Android OS and are a geek wanting to try out various applications in Market, then you are bound to see an error message pop up on your device “Insufficient Storage Available” and the application installation fails.  Or, suddenly your GMail would stop sync’ing mails.

This is one of the very common problems with Android OS as all applications, by default, get installed on your phone memory that isn’t too large.  [As a matter of fact, Windows Phones do not have any such issue].  So whichever Android phone/tablet you take up, you will end up with the same problem – and yes, with one quick solution.

With a broadband speed of 20MBPS or more, my bet would be a fix that would take you not more than 15 minutes, around 200 MB of your disk space on your laptop/desktop on which you have Administrator privilege. So here’s it!

Step 1:  Download and Install Java Development Kit from Oracle’s website.  I downloaded JDK 7u2 for Windows x64 (approximately 87 MB)

Step 2: Download and Install Android SDK from Google’s website.  I preferred the recommended Windows Installer

Step 3: Run Command Prompt with Administrator Privileges on Windows 7 or Windows 8 OS.  [Start Menu –> type in cmd –> Right click the Command Prompt –> Run as Administrator.  The UAC will prompt you with a dialog which you should click as ‘Yes’]

Step 4:  If you have installed the latest version of Android SDK (SDK Manager Revision 16 or later), then type in following commands on cmd

cd C:\Program Files (x86)\Android\android-sdk\platform-tools

You may want to verify & replace the folder on which you have installed the SDK.  If you are using an older version of Android SDK, you may want to give a try at following path C:\Program Files (x86)\Android\android-sdk\tools

Step 5: On your Android phone/tablet, go to Settings –> Applications –> Development and enable USB Debugging.  Once done, connect the phone/tablet to your laptop/desktop via USB cable.

image

Step 6: Execute following commands (highlighted in blue only) in sequence

adb shell pm getInstallLocation

You would get an output as: 0[auto]

In Android, Install Location has 3 values

0[auto] – Let the system decide the best location
1[internal] – Install the application on internal device storage.  This means any internal storage provided with your device
2[external] – Install the application on external media.  This means any SD, microSD cards attached to your device.

Step 7: So let’s change the default location to 2[external]

adb shell pm setInstallLocation 2

This will change the default installation location to SD card of all the applications that you install henceforth.  What about those that are already installed on device storage?  I am sure you were unable to move all of them to SD card earlier.   You can give it a try now!  Alternatively, you can download an application Apps2SD and manually move them to SD card.

To check if the settings changed or not, you can execute Step 6 again and check the results

Step 8: Disable USB debugging on your phone/tablet. Close the Command Prompt and enjoy!

Step 9:  Drop in a comment, if this helped you.  If there was something else you would like to say, drop in a comment.

Update – 1

To root your device, you can follow the instructions provided at: http://jailbreakandroid.org.  Please be aware that applying any patch to root the device is risky and hence the author of this website (that is me) takes no responsibility of any loss of data, OS, device operation whatsoever.  So please read the terms on the link above & the implications before applying it.

Update – 2


http://howtojailbreakandroid.com/ also provides information on rooting device

 

Update – 3 : For Samsung Devices

Apart from the steps mentioned above,

Dial *#9900# which will open the SysDump utility. Select Delete dumpstate/logcat which will free up the internal storage from all those logs

 

Installing Android on Windows

December 11, 2010 Android, Non-Microsoft ,

Now that’s a deadly combination specially if you are trying this out at half past one at midnight (just like I did).  Running two Operating Systems on a single machine is not a new concept. The first time I tried it was with DOS 6.2 and Linux, sometime in the 90’s.  Boot up the system and a shabby menu (or OS-launch pad) that launches (courtesy autoexec.bat file) and allows you to select an Operating System you would want to boot your system. Well, that is now an fogyish way that no one uses.

Later, there came these bootable OS DVDs that are used in many Linux-OSes that have alienated the OS launch-pad and have made things much easier, faster and without occupying much of disk space (at the cost of personalization).  So one OS at a time ruled the 90’s era.  Now, there are Virtual Hard Disks that enable you experience an Operating System even when you have already an Operating System in execution.  They consume same RAM, disk space and other h/w resources but now in a shared mode.  Now this is different from connecting to a machine remotely, so let’s not confuse ourselves with it.

So with this concept in mind, let’s get started to execute an Android on a machine that run Windows 8 Developer Preview.  Regardless of the version of Windows 8 & the  platform (x86 or 64-bit), the method to experience Android remains the same.

First the ingredients (the pre-requisities):

  • A Virtual Machine Software – you could choose any that is free.
  • A Virtual Image (ISO) of Android OS

An easier way first!

The easier way dictates using an already made Virtual Image and configure the VM for that Image (ISO).   Google has been kind enough to provide us a ISO file on its website: http://code.google.com/p/live-android/downloads/list and has multiple ways to download it.  If you have a Torrent Client with a 10MBPS line you can expect it to be downloaded in 2 mins.

Once downloaded, the steps are pretty easy

  • Open Virtual Machine Software (here Virtual Box)
  • Click on New and enter the name as ‘Android’
  • In the Operating System, select ‘Other’ and Version as ‘Other’ and click on Next
  • Assign min 256MB RAM to have a better experience. Click on Next
  • When asked for Boot Hard Disk, select ‘Create New Disk’
  • Click ‘Next’ till the Wizard ends

Voila! The cake is already half-baked. So next is to assign this Virtual Machine Host to the ISO we downloaded.

  • Right Click on Android
  • Click on Start
  • When asked for Devices, select CD/DVD ROM
  • For Media Source, select Image Source and locate the ISO file

In case you don’t find the above information, please let it go through the normal route.  You will find a menu called Device in the Virtual Machine Host and you can do the same steps there.  The next you see is a screen:

Android VM Launch Screen

Android VM Launch Screen

I preferred to select the default 800×600 resolution and Android OS was ready to run on my OS in less than half a minute.

I could browse the Internet, connect thr’ shared locations on my machine, play games & download apps too! Amazing experience in just 20 minutes!

The hard way – the developer way?

Well, who would want to know the hard way once you know there is an easier way to crack the puzzle.  But just ping me or leave comments on this.  I will surely pull off the curtains on the other way to do this.

Keep commenting!

Follow on Feedly