Wednesday, August 29, 2012

Tuesday, August 7, 2012

Geolocation in Android

Géolocalisation dans Android


Geolocation in Android

In this section we will resume our tutorial "in Google Map integration Android" that allowed to view a Google map in the main activity of the application and add markers.

 
 

  • LocationListener 
To use the services of geolocation android, the first step is to implement the interface LocationListener in the core business of our project "HelloMap".
  • LocationManager class provides access to location services system.
LocationListener is used for receiving notifications of LocationManager when the position changes. The latter uses four required methods which are:

     OnLocationChanged (Location location) Called when the user's position changes.
     OnProviderDisabled (String provider): Called when the source (GPS or Network) is disabled.
     OnProviderEnabled (String provider): Called when the source (GPS or network) is enabled.
     OnStatusChanged (String provider, int status, Bundle extras): Called when the status of the source changes.



AndroidManifest.xml

First we will add the required permissions to access the location services and GPS:

android:name="android.permission.ACCESS_COARSE_LOCATION'' />
android:name="android.permission.ACCESS_FINE_LOCATION''/>

 
MainActivity.java

Our main class must implement the interface LocationListener as follows:


public class MainActivity extends MapActivity implements LocationListener {
 
private MapView mapView = null;


private LocationManager lmanager;


private List  mapOverlays = null;


private OverlayItem overlayitem;


private GeoPoint point ;


private Drawable drawable;


private double lat, lng;

@Override
public void onCreate(Bundle savedInstanceState) {


super.onCreate(savedInstanceState);


// faire appel à notre vue principale qui contient la carte de Google maps
setContentView(R.layout.main);


mapView = (MapView) findViewById(R.id.mapview);


mapView.setBuiltInZoomControls(true);


mapView.setSatellite (true);


// ajouter le contrôleur de Zoom
mapView.setBuiltInZoomControls(
true);


// récupérer le service de localisation
lmanager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);


// demander au service de localisation de nous notifier tout changement de position sur la source (GPS)
lmanager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
this);


// récupérer l’icône qui sera affichée sur la carte
drawable =
this.getResources().getDrawable(R.drawable.marker);
}


@Override
protected boolean isRouteDisplayed()


{
return false;
}

// Lorsque la position change...
public void onLocationChanged(Location location) {}


// Lorsque la source (GPS ou Réseau 3G…) est activée
public void onProviderEnabled(String provider) {}


// Lorsque le statut de la source change
public void onStatusChanged(String provider, int status, Bundle extras) {}


// Lorsque la source (GPS ou réseau GSM) est désactivée
public void onProviderDisabled(String provider) {


// désactiver le service de Localisation et libérer les ressources

lManager.removeUpdates(this);

}}

  • OnLocationChanged

In this method we will recover the geographical coordinates of the terminal at each update (the frequency is defined through the method requestLocationUpdates ()). His details will be displayed to the user through a toast. We will also recover MapController class that will handle the zoom level of the map and animate it by changing the position of the terminal.
 
 @Override
public void onLocationChanged(Location location) {


if (location!=null)

{


// récupérer la liste "mapOverlays" des overlay ajoutés à notre MapView
mapOverlays = mapView.getOverlays();


lat = location.getLatitude(); // récupérer la Latitude de la position courante


lng = location.getLongitude(); // récupérer la Longitude de la position courante


// si "mapOverlays" est videif (mapOverlays.size()==0)


{


// ajouter un marqueur sur la position actuelle du terminal
newPosition();


}else
{


// supprimer tous les éléments de la liste
mapOverlays.clear();


newPosition();


}}
}
 
Here is the method to retrieve the position of the terminal and add a marker on the map:
 
public void newPosition (){
 
// créer un géopoint à partir de la position courante du terminal
point =
new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));


// ajouter un marqueur sur la position courante du terminal
overlayitem =
new OverlayItem(point, "Orange DevCenter", "je suis au dev center");


// instancier la classe "HelloItemizedOverlay"
HelloItemizedOverlay itemizedoverlay =
new HelloItemizedOverlay(drawable, MainActivity.this);


itemizedoverlay.addOverlay(overlayitem);


mapOverlays.add(itemizedoverlay);


mapView.invalidate(); // rafraichir la carte


Toast.makeText(getBaseContext(),


"Votre nouvelle position est: Latitude = " + (lat * 1E6) + " Longitude = " + (lng * 1E6),


Toast.LENGTH_SHORT).show(); // afficher la nouvelle position dans un Toast


mapView.getController().animateTo(point); // centrer la carte sur la position du terminal


mapView.getController().setZoom(12); // définir le niveau de zoom 12
}
 
  • Test

To test the geolocation service of our application, three options are available:

     Androphone:  Run application on an Android device physics and enable GPS
     Emulator:       Included with the SDK.
     A telnet client (PuTTYtel):   To use, just launch it and complete the fields below (Host Name: localhost and Port 5554). Regarding geolocation command is: geo fix latitude longitude.

In the event that you will use the Android emulator: In view of DDMS eclipse, you have the window "Emulator Control" in which he has the "Rent Control" where you can send your coordinates to emulator by entering the longitude and latitude of a given position.
 
 

Tuesday, July 24, 2012

How to Unsent | Undo A Send Email in Gmail

We does some time commit mistake and may be send wrong message or undesired message to different person but friends do you know there is a option of Undo/Unsent a send email in Gmail yes it can be possible ...

(May For Some People If they already know it then it might old for you )
if you know it then it is well and good if you don't know then follow this simple tutorial that helps you in undoing an E-mail.

Step By Step Guide for Undo/unsent a send email



  • First of all log in into your gmail account.(Obviously From Pc)

  • Goto "Settings" link in the upper right corner. It will be located next to your Gmail address in bold text to the left, and "Help" and "Sign Out" to the right. Click on it.

  • Locate the "Labs" tab. It will be near the end of the list of tabs. Click on "Labs" and wait for its loading .

  • Scroll to bottom of the page. With the available Google Labs options for Gmail listed in alphabetical order, this puts "Undo Send" at the end of the list. To the right of the brief information box are two bubbles. Check the "Enable" bubble, and then "Save Changes" at the very bottom.


  •  You Can also Customize the time delay. The default timing for delaying the sending of an email is 10 seconds. If you want you can change as per your requirement :D. 

  • Now when ever you send an email and test it your self there will be an option at the right side top corner for undo send email.

  • Click on that button and your email will be unsent. Showing message like “Sending Has Been Undone”


  • Now i guess this make you a clear idea how you can undo a send email .
    Well if you have two email id then you can test it and verify it thats all for today .
    Actually this post is demanded by one of my close mate "Suranjan Mund" So buda i guess you will like this .

    Thank you everyone do share :)

    Friday, July 20, 2012

    App Store bypassed without jailbreaking (how to install payed apps from apple store for free)



    in_app_purchase_hack_confirm
    Apple is investigating yet another security breach in its iTunes app store . A Russian hacker worked out a way that allows people to bypass payment in the App Store and download products for free.

    The hacker, dubbed ZonD80, posted a video of the crack on YouTube (Deleted by Youtube now) and claims that the technique makes it possible to beat Apple's payment systems by installing a couple of certificates and assigning a specific IP address to the device.

    The new service, which has already been subject to attempts at shutting it down, requires no jailbreaking and only minimal configuration changes. It works by funneling purchase requests through a server operated by the hacker, rather than the legitimate one offered by Apple. As a result, charges that normally would be applied to a user's account are bypassed.
    Below are the steps to the hack:
    • Install two certificates: CA and in-appstore.com.
    • Connect via Wi-Fi network and change the DNS to 62.76.189.117.
    • Press the Like button and enter your Apple ID & password.
    • Using the above hack, you are actually stealing in-app purchase content from developers, which is kind of disturbing and is of course against developer’s terms of service.
    ZonD80 is now asking for donations to set up a website to promote the hack."Why you must to pay for content, already included in purchased app? I think, you must not," he said.


    Apple has responded with the following statement:“The security of the App Store is incredibly important to us and the developer community,” Apple representative Natalie Harrison. “We take reports of fraudulent activity very seriously and we are investigating.”



    Obama will control internet, signs Emergency Internet Control

    Emergency+Internet+Control
    Barack Obama has signed an executive order that could hand control of the internet to the U.S. Government, in the event of a natural disaster or terrorist attack. "The federal government must have the ability to communicate at all times and under all circumstances to carry out its most critical and time sensitive missions," Obama said.

    President Obama adds that it is necessary for the government to be able to reach anyone in the country during situations it considers critical, writing, “Such communications must be possible under all circumstances to ensure national security, effectively manage emergencies and improve national resilience.” Later the president explains that such could be done by establishing a “joint industry-Government center that is capable of assisting in the initiation, coordination, restoration and reconstitution of NS/EP [national security and emergency preparedness] communications services or facilities under all conditions of emerging threats, crisis or emergency.”
     
    But Section 5.2 has raised alarm among those who fear the government will have too much control over the Web. The section explained how the secretary of homeland security - currently Janet Napolitano - will 'satisfy priority communications requirements through the use of commercial, Government, and privately owned communications resources, when appropriate.'

    White House officials have acted quickly to ease concern, insisting the order is just an update of an existing authority dating back to 1984 . The claim the government has been granted no extra powers.