Wednesday, September 16, 2015

Google Maps implementation using Ionic Framework

Ionic framework seems to be promising in developing cross platform mobile applications. Currently it works very well on Android and IOS , but limited on Windows Phone. Lets have a small introduction on how to implement google maps using Ionic Framework as a beginner view.

Lets start with implementation of View using HTML5 Ionic template

<ion-view title="Map Demo
<ion-pane>
<ion-content overflow-scroll="true" ng-controller="MapController">
<div id="map" data-tap-disabled="true"></div>
</ion-content>
</ion-pane>
</ion-view>

Please add this script to the index page
<script src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=true"></script>



Controller Implementation probably app.js or controller.js

.controller('MapController', ['$scope', function($scope) {

function initialize() {

    var latLng = new google.maps.LatLng(17.80303,79.0345);

    var mapOptions = {

      center: latLng ,

      zoom: 16,

      mapTypeId: google.maps.MapTypeId.ROADMAP

    };

    var map = new google.maps.Map(document.getElementById("map"),

      mapOptions);

     

    var marker = new google.maps.Marker({

      position: latLng ,

      map: map,

      title: 'Map Demo'

    });



 

    $scope.map = map;

  }

  google.maps.event.addDomListener(window, 'load', initialize);

}]);



Thats it, Happy coding

Wednesday, December 3, 2014

Developing Mobile Apps with the Ionic Framework

            Here are the presentation slides on developing mobile apps using Ionic Framework
 
                           

Wednesday, August 10, 2011

Importance of intent flag FLAG_ACTIVITY_REORDER_TO_FRONT in Android?

Today i was studying a lot about Task affinities and Back Stack and trying to understand them clearly as i am running into a situation where i launched an activity two times. Look at this scenario i have a menu with five options say A , B , C , D and E which are different activities meant for different purposes. I launched B activity then A activity then C activity and again A activity and i pressed back key now A activity is finished C is displayed again i pressed back key as per my imagination it should display B activity but i was surprised to see A activity.
B -> A -> C -> A on pressing back key it should be A -> C-> B
It seems that it maintains the back stack without reordering and i came across an useful flag in Intents class FLAG_ACTIVITY_REORDER_TO_FRONT which will solve this kind of issues when intent resolves to the activity in the current task it moves this activity to the top of the stack in this way.
B->A->C->A will be reordered as B->C->A

So the code will be as follows
Intent intent = new Intent();
intent.setClass(...., ....);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);

Happy coding .....

Monday, August 8, 2011

How to save images from img tags and css from stylesheet tags using Regular Expression in Android?

Regular Expressions are the best way to use for search a particular pattern using special syntax. Even though it looks complex to understand it simplifies searching and replacing in text processing and parsing the text. Most of the editors commonly use regex for searching and replacing so its usage is common across any programming languages. I used it for html parsing for an Android applications mainly img tags and css tags which i need to store it in local file system for offline usage.

The following regex pattern is used to retrieve the css path from the html page
".*?(\"text\\/css\").*?((?:\\/[\\w\\.\\-]+)+)" So the code snippet will be like this
Pattern p = Pattern.compile(regex);
Matcher m = p.match(fileName) //fileName is the document we want to parse;
if(m.find())
{
String word = m.group(1); // this gives the exact word ex: text/css
String path =m.group(2); // this gives the relative path like /css/xyz.css
}
Many people suggest to use parses like jsoup neckohtml etc which are under GPL but if the requirement is just parsing few search terms it will be easier to use Regex since we dont need to include external jar files.

Happy coding........

Sunday, July 31, 2011

How to enable telnet on windows 7 for various android commands

I am currently developing some applications on Location Based services for Android devices. Most of the time i need to use emulator for testing the applications and i need to connect to devices using telnet for example geo fix some coordinates of one location. Recently i was not able to launch telnet in windows 7 and i found that its not enabled by default. So whoever gets stuck with this try to enable it by using start menu -> controlpanel -> programs -> program features -> Turn on/off window features which will load all the features do check the Telnet client box and say ok it will enable the telnet. In order to test it launch start menu and in search program box enter telnet it will display telnet command line program on pressing it will launch the telnet console which can be used for connecting to emulator using telnet commands like
o localhost 5555 (for opening the emulator host) and then
geo fix 37.24 , 112.220( for fixing the latitudes and longitudes)

Happy coding...............

Tuesday, September 28, 2010

BlackBerry PlayBook tablet to take on IPad

Research in Motion the maker of blackberry unveiled Playbook tablet which is half the size of IPad , It has got leading power, multitasking , awesome browser experience and a very high performance multimedia. It also support high definition 1080 video and carries both front and rear cameras. It is powered by 1GHz dual core processor and operate on a new platform that's built by QNX software. Unfortunately wifi is not available to the users but they can connect to the net through their blackberry smart phone.
Snapshot of the RIM PlayBook

Monday, May 10, 2010

Cool Android UI features - Sony Ericsson

I have found this cool video from sony ericsson blogs about the cool Android features that are available to the developers to customise their UI. Check this video.