Monday, May 23, 2016

How to take release build for Google Play Store using Cordova


Step 1: Navigate to your Project Folder in command prompt

Step 2: Type "cordova build --release android"

Step 3 : Navigate to build output path: ...\platforms\android\build\outputs\apk

Step 4: Sign apk using below command
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore YOURAPP.keystore android-release-unsigned.apk YOURAPP

Step 5: Compress/zip  apk
Naivate to below path in command prompt:
C:\AndroidStudio\build-tools\23.0.2\
Run the below command
zipalign -v 4 android-release-unsigned.apk YOURAPP.apk

Now the APK is ready in below path to release in Play store
  ../platforms\android\build\outputs\apk\YOURAPP.apk

Monday, February 29, 2016

Cordova app - OnDevice ready event is NOT firing /stopped firing

Today when I ran my app "ondevice ready" suddenly stopped firing which was working fine earlier.

After few hours of wasting time, old build version helped me to found the root cause :-)

Yes, I missed "cordova.js" lib reference in new version pages.

Finally fixed the issue by adding "cordova.js" lib ref

<script type="text/javascript" src="cordova.js"></script>

Tuesday, January 19, 2016

How to setup MongoDB environment

Recently I had setup MongoDB in my machine, here sharing the learning of end to end steps involved to setup Mongo DB and confirm the installation.

Steps to install MongoDB

Ø  Go to https://www.mongodb.org/downloads#production and grab installation file, make sure you selected correct development environment
Ø  Start run the installation file and follow the prompts
Ø  Installation path prompt click “Custom” and change the installation path to “C:\MongoDB” ( just for easy reference purpose)
Ø  Add the installation path (C:\MongoDB) to environment variables
Steps to add in environment variables:
Windows 7:
                My Computer > Properties > Change settings > Advanced > Environment variables
              > Click Path > Edit > at the end of existing entries type semicolon “;” and add installation path “C:\MongoDB” next to that. > Click Ok > Ok.

Ø  Once installation finished open the folder “C:\MongoDB” and create 2 sub folders inside it
two subfolders:  “conf”, “log”
Ø  Open a text editor and add the following code :
# mongodb.conf
# point mongodb to the data directory
dbpath=C: \data\db
# tell it where to log messages
logpath=C:\mongodb\log\mongodb.log
logappend=true
# only run on localhost
bind_ip = 127.0.0.1                                                            
port = 27017
rest = true
Ø  Save the file with name “Mongodb.conf” and save it inside the folder “C:\mongodb\conf”
Ø  Go to “C” drive and create a new folder “data”  (i.e C:\data )
Ø  Go to created folder and create a subfolder with name “db”. So the path will be “C:\data\db”

You are done, MongoDB setup is done.
Here’s the steps to confirm the setup:
Ø  Open command prompt
Ø  Navigate to “C:\MongoDB\Bin” folder in command prompt
Ø  Type “Mongod” and enter
Ø  You should able to see messages like “Waiting for connections on port 27017”
Ø  Open a new command prompt ( don’t close exiting command prompt)
Ø  Navigate to “C:\MongoDB\Bin” folder in command prompt
Ø  Type “Mongo” and enter
Ø  You will be getting a message “MongoDB shell version and connecting to “test” db”
Ø  Also if you see in another opened command prompt, the message will be changed to “Connection accepted from “127.0.0.1”…etc”


That’s it , your setup and confirmation done. Now you can start interacting with db either through app or via cmd prompt.