Skip to main content

How to take raw data from an android mobile phone's GPS..?

Hello friends
                        Today i am gonna to discuss about taking raw data or coordinate from an android mobile GPS device.

Let's Start................

Step:1


Just enter into programming mode in android studio.
If you don't know that how to do that please read this post.

Step:2



Now just make a new class as show in figure and name it BootService.

Step:3

Now extends Service and implements LocationListener as shown in figure below.


Step:4

Now just copy and paste following code into BootService class.




LocationManager lm;


@Override
public int onStartCommand(Intent intent, int flags, int startId)
{

lm = (LocationManager) getSystemService(LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 1, this);

return START_STICKY;
}

@Override
public void onLocationChanged(Location location) {

try{

Toast.makeText(this, "GPS Values Found: " + String.valueOf(location.getLongitude()) + " : " + String.valueOf(location.getLatitude()), Toast.LENGTH_SHORT).show();
}catch(Exception ex){
Log.i("Error in getting location valus", ex.getMessage());
}
}

@Override
public void onProviderDisabled(String provider) {
/* this is called if/when the GPS is disabled in settings */

/* bring up the GPS settings */
//Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
//startActivity(intent);
Toast.makeText(this, "GPS Disabled", Toast.LENGTH_SHORT).show();
}

@Override
public void onProviderEnabled(String provider) {
Toast.makeText(this, "GPS Enabled", Toast.LENGTH_SHORT).show();
}

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
/* This is called when the GPS status alters */
switch (status) {
case LocationProvider.OUT_OF_SERVICE:
Toast.makeText(this, "Status Changed: Out of Service",
Toast.LENGTH_SHORT).show();
break;
case LocationProvider.TEMPORARILY_UNAVAILABLE:
Toast.makeText(this, "Status Changed: Temporarily Unavailable",
Toast.LENGTH_SHORT).show();
break;
case LocationProvider.AVAILABLE:
Toast.makeText(this, "Status Changed: Available",
Toast.LENGTH_SHORT).show();
break;
}
}


@Override
public IBinder onBind(Intent arg0)
{
return null;
}

Step:5

Now Just copy and paste following permissions into manifest file.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

<service android:name=".BootService"></service>



Step:6
Now just connect your mobile phone to pc via USB cable and click on run in android studio.This will install app into your mobile,where you can see GPS values as toast message.

IF YOU HAVE ANY QUERY PLEASE COMMENT BELOW

Comments

Popular posts from this blog

Real life Jarvis-Talk With Your Computer like Jarvis in Iron Man ....!

By:Prayag nao                                            Code to Make your Computer like Jarvis New Speech macro..>> Choose Advanced and change the code like this.. <speechMacros>   <command>     <listenFor></listenFor>   </command> </speechMacros> You have to add a commands  <listenFor>........</listenFor> - computer listens the words you specify here and respond accordingly. <speak>............</speak> - computer speaks what is written in this field according to the command which it got. Similarly, You can Edit more commands in the same way.   <speechMacros> <command> <listenFor>What's going on dude</listenFor> <speak>Nothing special tony</speak> </command> </speechMacros> This is just a basic command,If you want more advanced commands.you have to use Java Scripts and VB scripts . Tell me Time : This is d

HOW INTERNAL EXPANDING BRAKE WORKS

By:Prayag nao An internal expanding brake consists of two shoes S 1 and S 2 . The outer surface of the shoes are lined with some friction material (usually with Ferodo) to increase the coefficient of friction and to prevent wearing away of the metal. Each shoe is pivoted at one end about a fixed fulcrum O 1 and O 2 and made to contact a cam at the other end. When the cam rotates, the shoes are pushed outwards against the rim of the drum. The friction between the shoes and the drum produces the braking torque and hence reduces the speed of the drum. The shoes are normally held in off position by a spring . The drum encloses the entire mechanism to keep out dust and moisture. This type of brake is commonly used in motor cars and light trucks.   We shall now consider the forces acting on such a brake, when the drum rotates in the anticlockwise direction . It may be noted that for the anticlockwise direction, the left hand shoe is known as leading or primary shoe

HOW TO SEND FAKE SMS VIA WEB

SEND FAKE SMS VIA WEB: You are looking for free SMS spoofing sites. You want to send fake SMS text messages, targeted for recipients to U.S, Canada, Australia or anywhere in the world without paying a single cent? There was nowhere you could find it, but now you have a chance. When SMS Spoofing site FakeMSG.com launched the first iPhone application to send spoof sms through BigBoss (for jailbroken iPhones), it was giving out one free SMS credit for every unique iPhone app user, but soon ended the offer due to widespread craze and abuse. visit URL: http://www.bulksms.com/      2.  now select BulkSMS International (€) under Select your regional site here now      3.now sign up and get a code on your phone via sms.entring code on site you will get 5 free credit.    4.now you can send fake sms to anyone .ENJOY.........!!!!! Warning: Send Fake SMS is probably illegal and we don’t advise you to do