Showing posts with label map. Show all posts
Showing posts with label map. Show all posts

Feb 28, 2014

Weather app V6 (add weather map using google map API+Notification)


This Version I added weather map.


I added '지도보기' button in mainactivity.

If you touched this button that can be seen weather map.

I got this map from google maps library.

So, you see the different weather.

Because, main get from KMA and mapweather get from google.

And I added Notification.





You can be see new button,"지도보기".

If you touched '지도보기'button that can be seen google weather map. 

If you touched weather icon, can be seen detail information.

If you scroll down that can be seen notification information.

You can be seen Current location and current weather.

If you touched notification bar, app moved weather app.


Feb 17, 2014

MyLocation&MyPath (some added version)




I used to 'watchPosition' method for 'function getMylocation()'.

  1. function getMylocation(){
  2.     firstTime=false;
  3.     if(navigator.geolocation) {
  4.      keycnt=navigator.geolocation.watchPosition(success,error2,geoOptions);
  5.     } else {
  6.    handleNoGeolocation(false);
  7.   }
  8. }

It detect to your location is changed.

And I add option that 'enableHighAccuracy'.


  1. geoOptions={
  2.       enableHighAccuracy : true,
  3.       timeout: 5000,
  4.       maximumAge: 0
  5.   };


It option is Increases the accuracy of location.



Feb 13, 2014

My Location&My Path app(do it android mission 20)


This app is display my current moving path on map.

If you run the app the app displays 3 button and 1 input text.

If you touched 'rec' button then app getting your location using GPS or Network every 3 second.

And app save in database that displays your moving path on map using polyline.

If you touched 'stop' button then app delete polyline and database.


This picture is normal state(you run the app)

This picture is touched 'rec'button

This picture is touched 'stop' button


1. Using Database


Adding MainActivity.java code for using database

MainActivity.java

  1. mapview.getSettings().setDatabasePath("/data/data/"+this.getPackageName()+"/databases/");
  2. mapview.getSettings().setDomStorageEnabled(true);
  3. mapview.getSettings().setDatabaseEnabled(true);
  4. mapview.getSettings().setAppCacheEnabled(true);
It code need for using database.

and need a javascrpit code

index.html

  1. function setdatabase(){
  2.     getMylocation();
  3.     var sumlatlnt=curLat+","+curLng;
  4.     localStorage.setItem(keycnt,sumlatlnt);
  5.     keycnt++;
  6. }
important is "localStorage.setItem(key,value)"

This code is record to database.

and if you reading value in database

You need a this code

"var temp=localStorage.getItem(key)"

and remove code is
"localStorage.removeItem(key)"


2. overlay using polyline

It's simple drawing polyline using google maps API

you just add this code to initialize
  1. var polyOptions = {
  2.     strokeColor: '#000000',
  3.     strokeOpacity: 1.0,
  4.     strokeWeight: 3
  5.   };
  6.   poly = new google.maps.Polyline(polyOptions);
  7.   poly.setMap(map);
  8.   path = poly.getPath();
you possible to reference google API about polyOption.

and adding event function "path.push(event.latLng);"

But I used another method.

  1. if(navigator.geolocation) {
  2.      navigator.geolocation.getCurrentPosition(function(position) {  
  3.          curLat=position.coords.latitude;
  4.          curLng=position.coords.longitude;
  5.          var newpos = new google.maps.LatLng(curLat,curLng);
  6.          map.setCenter(newpos);
  7.          path.push(newpos);
  8.      }, function() {
  9.       handleNoGeolocation(true);
  10.     });
  11.    
  12.      
  13.   } else {
  14.    
  15.     handleNoGeolocation(false);
  16.   }
because I want my current location using gps

"path.push(latLng)" is draw polyline on map.

And "path.clear()" is clear polyline on map.







Feb 11, 2014

GEOLOCATION for Google Maps JavaScript V3


Google Maps API V3 is difficult for me. because I don't know JavaScript& PhoneGap...

Google Maps API HTML source works for PC's web browser.

But doesn't work My Android Phone...;;;

I tried founding method. But very difficult that studying Jquery& PhoneGap...

Finally, I solved. 

This is another method.

This code is simple.

No changed HTML source. 

Just Google API source.

I get HTML source from google api page.

I added webview and permissions.

And MainActivity is I referenced this site


If you run this app that will see your location.