Quick Tip

Use Standalone Visual Studio Emulator for testing Android Apps

Microsoft is now providing Visual Studio Emulator for Android which can be used to deploy, test and debug Android apps. It also comes with a standalone version which can be used for quickly testing your APK files without needing Visual Studio which is very helpful for hybrid apps which are not built using standard development tools. For example if you have built your app using cordova and are looking for testing your app on a few emulators and are short of actual physical devices then this emulator comes handy which currently has support up to Marshmallow (API level 23). Download the standalone emulator installer from https://aka.ms/vscomemudownload Click on the installer and go through the installation process. It uses Hyper-V for running the emulator so it may ask you to confirm on activating it. Once it is installed you can open the emulator by searching for “Visual Studio Emulator for Android” in your windows[…]

Cordova Error: Android SDK not found. Make sure that it is installed

I recently tried to upgrade Cordova app which was last compiled almost an year back and got the following error Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable. I turns out that I had updated Android SDK version on my PC during that time and all I needed to do was to update the platform version in the app as well. Using Node.js Command Prompt and cordova commands, check the installed platform in the app using the following command cordova platform version android Update the installed platform version in the app using the following command cordova platform update android While upgrading the app additional issues I faced were related to plugins not being compatible with the new platform version which were fixed by simply removing the plugins and re-adding it which in some cases[…]

Quick Tip

Trim object info in Javascript

Use this method to trim JS object values and display only the required info (which I do a lot for deugging purposes). Here is what gives me a concise info I am looking for while debugging my code in JS. function trimInfoInArray(array, props) { return array.map(function (item) { var obj = {}; for (var i = 0, len = props.length; i < len; i++) obj[props[i]] = item[props[i]]; return obj; }); } function trimInfoInObject(object, props) { var obj = {}; for (var i = 0, len = props.length; i < len; i++) obj[props[i]] = object[props[i]]; return obj; } Now the example on how to use it is as following var player1 = {id: 1, name:’Tom’, Age: 30} var player2 = {id: 2, name:’Jon’, Age: 28} var players = [player1, player2] console.log(JSON.stringify(trimInfoInArray(players, [“id”, “name”]))); console.log(JSON.stringify(trimInfoInObject(player1, [“id”, “name”]))); With some objects having hundreds of properties and printing those values and searching for just the[…]

PropellerAds Native Banner only works in Chrome

I recently decided to give it a shot and see what kind of interaction do I get with this ad. Unfortunately it comes with certain issues and won’t work on any browser other than Chrome. I tried it on Firefox, Chrome and IE11 and the ad loaded only on one browser (Chrome). I recehed out to PropellerAds support team which after a few iterations admitted that it is working on Chrome only. IE displays the following error Firefox displays a different error    

Quick Tip

Solution: Windows PC not reading Xiaomi Phone via USB cable

The first step is to enable developer option in the phone. Go to Settings -> About Phone and tap MIUI version 6 times. You will see a pop up notification confirming that the developer option is enabled. Now enable USB debugging in the phone Go to settings -> Additional Settings -> Developer options then enable USB debugging. Now connect your Xiaomi phone to your Windows PC via USB cable. When you connect phone to the PC, it might ask to select an option to connect for charging only or files transfer. Make sure to select files transfer option. On your computer go to PC -> C drive (or whatever is the installation drive of your Windows) -> Windows -> INF -> Look for wpdmtp.inf. Right click on wpdmtp.inf and click install with your phone plugged in. Now you should see the phone showing up under PC.