Latest Post

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.

Compile Cordova App for iOS

I recently planned to compile my Phaser games for iOS App Store. These games were build using Cordova CLI and have already been published on Android Store so I already have a functioning game which was to be ported to iOS. I decided to document the steps I had to follow to get my game compiled and published to iOS App Store. You can develop the game on any platform of your liking but in order to compile and publish these games to iOS App Store you do need to have a Mac. It can not be done from Windows or any other platform. Steps to compile the game: Download MacOS installer for Node.js and install it on your Mac. Go to App Store on your Mac and install latest version of XCode. You need XCode to build the game. Open Terminal console (Finder -> Applications ->Utilities) on your MacOS and install cordova using npm utility of Node.js by[…]

Cordova iOS Mobile App displays White Background Color after Splash Screen

Cordova Mobile apps display a white background right after Splash screen. This happens because WebView is loaded before our app is initialized. I tried many suggestions such as setting AutoHideSplashScreen to false and then call navigator.splashscreen.hide() in deviceready function which did not work for me. It gets called before WebView is even loaded. After trying a lot of things I finally had to look into the main view controller code which is automatically generated by Cordova (I am using Cordova 8.0.0). Go to MainViewController.m file in the platforms/ios/CordovaLib/Classes folder and look for following code – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } Add the lines highlighted as below. I used a transparent Splash screen (which gives black background while splash screen is shown) and changed the background color of the WebView to the color which matched with my app’s background color. – (void)viewDidLoad { [super viewDidLoad]; self.webView.opaque=NO; self.webView.backgroundColor =[…]

Phaser Cordova Mobile App Crashing on iOS

I recently decided to compile Phaser games to iOS and publish to The App Store. The games were already published on Google Play Store for Android and worked without any issues. I faced few issues after compiling Phaser games for iOS. The first issue which I faced was the game crashing randomly on iOS. After doing further research I found this article on Intel XDK forum which turned out to be the reason for crash. The games were written a while back with older versions of Phaser and I did not get time to upgrade and test this with newer versions of Phaser (CE and higher) so I decided to try the fix specified in this thread and voila, it worked just fine. Here is the code which I borrowed from the thread var mygame; window.onload = function () { mygame = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, “mygame”); mygame.state.add(“Boot”, Boot); mygame.state.add(“Loading”, Loading); mygame.state.add(“MainMenu”, MainMenu); mygame.state.add(“TheGame”, TheGame); mygame.state.start(“Boot”); function onPause() { if(!mygame.paused)[…]

Best Shared Hosting

Hosting services can ruin Google ranking, learn why?

Learn Why Bad Hosting Can Ruin Your Google Rankings Everybody knows that Google have over 200 factors that go into their algorithm of website ranking. Nobody (except Google) knows what exactly those factors are, however, SEO specialists have picked out some really important ones, the effect of which can be measured. When you are done with your website’s design, content, quality internal and external links, heading and title tags, keywords, and everything that depends on the web developer (programmer code and databases optimization), you are ready for the last step – uploading your website on the server and publishing it for the whole wide world to see. If you are looking for reliable shared hosting under 1 USD click here > SEO experts recommend choosing your hosting carefully as all the hard work done while building your website may be ruined instantly by uploading the site on an inappropriate hosting. […]

Quick Tip

Send Email from GoDaddy Asp.Net Application

In my previous article we looked at how to use Google account and SMTP server to programatically send mail to an email address. We can use the same code with minor changes for GoDaddy application which is using shared hosting. We will develop a “Contact us” page here using SMTP server from GoDaddy. The first step is to create a web service using System; using System.Configuration; using System.Net.Mail; using System.Web.Services; namespace GoDaddy.Email { /// <summary> /// Summary description for Mail /// </summary> [WebService(Namespace = “http://tempuri.org/”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class Mail : System.Web.Services.WebService { [WebMethod] public string SendEmail(string email, string name, string body) { try { var toEmailAddress = ConfigurationManager.AppSettings[“ToEmailAddress”].ToString(); var smtpHost = ConfigurationManager.AppSettings[“SMTPHost”].ToString(); var smtpPort = ConfigurationManager.AppSettings[“SMTPPort”].ToString(); MailMessage mailMessage = new MailMessage(); mailMessage.To.Add(toEmailAddress); mailMessage.From = new MailAddress(email, name); mailMessage.Subject = “Contact[…]

Quick Tip

Send Email from Asp.Net Application using Google Account and SMTP

In order to send mail from the application we can use SMTP server from Google (which off course has certain limitations). We can use a Google mail account and send the mail using SMTP server from Google. This works very well for Asp.net applications which need to use a simple form such as “Contact Us”. An example of this is explained below. We will use AJAX to send the request to an ASP.Net web service which sends the mail from the server side. Create a web service as following using System; using System.Configuration; using System.Net.Mail; using System.Web.Services; namespace GoDaddy.Email { /// <summary> /// Summary description for Mail /// </summary> [WebService(Namespace = “http://tempuri.org/”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class Mail : System.Web.Services.WebService { [WebMethod] public string SendEmail(string to, string subject, string body)[…]