最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

Android查看手机位置,android

互联网 admin 45浏览 0评论

Android查看手机位置,android

我想找到纬度&输入手机号码时的经度.

有什么办法可以在android吗?

解决方法:

恩……希望我能告诉您可以做到这一点,但前提是:

>您拥有手机

>您已经安装了移动应用程序(收费较好)

>为此,您不受法律禁止

至于编码,

这是示例代码.

主要活动:

package com.schogini.SimpleTracker;

import java.io.File;

import java.util.ArrayList;

import java.util.List;

import java.util.Locale;

import android.app.Activity;

import android.app.PendingIntent;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

import android.content.IntentFilter;

import android.content.pm.PackageManager;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.location.Location;

import android.location.LocationListener;

import android.location.LocationManager;

import android.os.Bundle;

import android.telephony.gsm.SmsManager;

import android.telephony.TelephonyManager;

import android.util.Log;

import android.widget.Toast;

public class LaunchActivity extends Activity {

Context ctx;

String imei="1234567890";

String[] lv_arr,lstr;

int smscount=1;

double xpin=0.0,ypin=0.0;

SQLiteDatabase dbb;

Cursor cur;

TelephonyManager tmgr;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

//getting GPS data

LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

LocationListener mlocListener = new MyLocationListener();

mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);

//Exit program when Mission accomplished

LaunchActivity.this.finish();

}

private void sendSMS(String phoneNumber, String message)

{

String SENT = "SMS_SENT";

String DELIVERED = "SMS_DELIVERED";

PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,

new Intent(SENT), 0);

PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,

new Intent(DELIVERED), 0);

//---when the SMS has been sent successfully---

registerReceiver(new BroadcastReceiver(){

@Override

public void onReceive(Context arg0, Intent arg1) {

switch (getResultCode())

{

case Activity.RESULT_OK:

{

Toast.makeText(getBaseContext(), "SMS sent",

Toast.LENGTH_SHORT).show();

//sent=1;

break;

}

case SmsManager.RESULT_ERROR_GENERIC_FAILURE:

{

Toast.makeText(getBaseContext(), "Generic failure",

Toast.LENGTH_SHORT).show();

// sent=0;

break;

}

case SmsManager.RESULT_ERROR_NO_SERVICE:

{

Toast.makeText(getBaseContext(), "No service",

Toast.LENGTH_SHORT).show();

//sent=0;

break;

}

case SmsManager.RESULT_ERROR_NULL_PDU:

{

Toast.makeText(getBaseContext(), "Null PDU",

Toast.LENGTH_SHORT).show();

// sent=0;

break;

}

case SmsManager.RESULT_ERROR_RADIO_OFF:

{

Toast.makeText(getBaseContext(), "Radio off",

Toast.LENGTH_SHORT).show();

// sent=0;

break;

}

}

}

}, new IntentFilter(SENT));

//---when the SMS has been delivered---

registerReceiver(new BroadcastReceiver(){

@Override

public void onReceive(Context arg0, Intent arg1) {

switch (getResultCode())

{

case Activity.RESULT_OK:

{

Toast.makeText(getBaseContext(), "SMS delivered",

Toast.LENGTH_SHORT).show();

//delivered=1;

break;

}

case Activity.RESULT_CANCELED:

{

Toast.makeText(getBaseContext(), "SMS not delivered",

Toast.LENGTH_SHORT).show();

// delivered=0;

break;

}

}

}

}, new IntentFilter(DELIVERED));

SmsManager sms = SmsManager.getDefault();

sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);

}

/* Class My Location Listener for GPS and location*/

public class MyLocationListener implements LocationListener{

@Override

public void onLocationChanged(Location loc){

double pinx=0.0, piny=0.0;

pinx=loc.getLatitude();

piny=loc.getLongitude();

String loca = "My current location is: " +

"Latitude = " +pinx +

"Longitude= " + piny;

Toast.makeText( getApplicationContext(),

loca,

Toast.LENGTH_LONG).show();

if(xpin!=pinx||ypin!=piny)

{

lstr[0]="GPS Latitude = " + loc.getLatitude() +" Longitude= " + loc.getLongitude();

sendSMS("5556", " "+lstr);

}

xpin=loc.getLatitude();

ypin=loc.getLongitude();

loca = "My old location is: " +

"Latitude = " +xpin +

"Longitude= " + ypin;

Toast.makeText( getApplicationContext(),

loca,

Toast.LENGTH_LONG).show();

}

@Override

public void onProviderDisabled(String provider){

Toast.makeText( getApplicationContext(),

"GPS Disabled",

Toast.LENGTH_SHORT ).show();

}

@Override

public void onProviderEnabled(String provider){

Toast.makeText( getApplicationContext(),

"GPS Enabled",

Toast.LENGTH_SHORT).show();

}

@Override

public void onStatusChanged(String provider, int status, Bundle extras){

}

}/* End of Class MyLocationListener */

}

接收启动完成的样本编码:

package com.schogini.SimpleTracker;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

public class MyIntentReceiver extends BroadcastReceiver {

// Called when boot completes

@Override

public void onReceive(Context context, Intent intent) {

// Set what activity should launch after boot completes

Intent startupBootIntent = new Intent(context, LaunchActivity.class);

startupBootIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

context.startActivity(startupBootIntent);

}

}

XML编码:(AndroidManifest.xml)

package="com.schogini.SimpleTracker"

android:versionCode="1"

android:versionName="1.0">

一些应用:

来自McAfee的WaveSecure

移动防御:

当心:

猎物:

盗窃意识:

wheresmyandroid

如果您已经丢失了电话,请向警察/网络部门投诉.您无法手动跟踪它.

建议购买类似的应用程序,以便有机会追踪您的手机并清除您的敏感数据.在此类应用程序中进行少量投资总是很方便的.

标签:android

来源: .html

Android查看手机位置,android

我想找到纬度&输入手机号码时的经度.

有什么办法可以在android吗?

解决方法:

恩……希望我能告诉您可以做到这一点,但前提是:

>您拥有手机

>您已经安装了移动应用程序(收费较好)

>为此,您不受法律禁止

至于编码,

这是示例代码.

主要活动:

package com.schogini.SimpleTracker;

import java.io.File;

import java.util.ArrayList;

import java.util.List;

import java.util.Locale;

import android.app.Activity;

import android.app.PendingIntent;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

import android.content.IntentFilter;

import android.content.pm.PackageManager;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.location.Location;

import android.location.LocationListener;

import android.location.LocationManager;

import android.os.Bundle;

import android.telephony.gsm.SmsManager;

import android.telephony.TelephonyManager;

import android.util.Log;

import android.widget.Toast;

public class LaunchActivity extends Activity {

Context ctx;

String imei="1234567890";

String[] lv_arr,lstr;

int smscount=1;

double xpin=0.0,ypin=0.0;

SQLiteDatabase dbb;

Cursor cur;

TelephonyManager tmgr;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

//getting GPS data

LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

LocationListener mlocListener = new MyLocationListener();

mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);

//Exit program when Mission accomplished

LaunchActivity.this.finish();

}

private void sendSMS(String phoneNumber, String message)

{

String SENT = "SMS_SENT";

String DELIVERED = "SMS_DELIVERED";

PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,

new Intent(SENT), 0);

PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,

new Intent(DELIVERED), 0);

//---when the SMS has been sent successfully---

registerReceiver(new BroadcastReceiver(){

@Override

public void onReceive(Context arg0, Intent arg1) {

switch (getResultCode())

{

case Activity.RESULT_OK:

{

Toast.makeText(getBaseContext(), "SMS sent",

Toast.LENGTH_SHORT).show();

//sent=1;

break;

}

case SmsManager.RESULT_ERROR_GENERIC_FAILURE:

{

Toast.makeText(getBaseContext(), "Generic failure",

Toast.LENGTH_SHORT).show();

// sent=0;

break;

}

case SmsManager.RESULT_ERROR_NO_SERVICE:

{

Toast.makeText(getBaseContext(), "No service",

Toast.LENGTH_SHORT).show();

//sent=0;

break;

}

case SmsManager.RESULT_ERROR_NULL_PDU:

{

Toast.makeText(getBaseContext(), "Null PDU",

Toast.LENGTH_SHORT).show();

// sent=0;

break;

}

case SmsManager.RESULT_ERROR_RADIO_OFF:

{

Toast.makeText(getBaseContext(), "Radio off",

Toast.LENGTH_SHORT).show();

// sent=0;

break;

}

}

}

}, new IntentFilter(SENT));

//---when the SMS has been delivered---

registerReceiver(new BroadcastReceiver(){

@Override

public void onReceive(Context arg0, Intent arg1) {

switch (getResultCode())

{

case Activity.RESULT_OK:

{

Toast.makeText(getBaseContext(), "SMS delivered",

Toast.LENGTH_SHORT).show();

//delivered=1;

break;

}

case Activity.RESULT_CANCELED:

{

Toast.makeText(getBaseContext(), "SMS not delivered",

Toast.LENGTH_SHORT).show();

// delivered=0;

break;

}

}

}

}, new IntentFilter(DELIVERED));

SmsManager sms = SmsManager.getDefault();

sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);

}

/* Class My Location Listener for GPS and location*/

public class MyLocationListener implements LocationListener{

@Override

public void onLocationChanged(Location loc){

double pinx=0.0, piny=0.0;

pinx=loc.getLatitude();

piny=loc.getLongitude();

String loca = "My current location is: " +

"Latitude = " +pinx +

"Longitude= " + piny;

Toast.makeText( getApplicationContext(),

loca,

Toast.LENGTH_LONG).show();

if(xpin!=pinx||ypin!=piny)

{

lstr[0]="GPS Latitude = " + loc.getLatitude() +" Longitude= " + loc.getLongitude();

sendSMS("5556", " "+lstr);

}

xpin=loc.getLatitude();

ypin=loc.getLongitude();

loca = "My old location is: " +

"Latitude = " +xpin +

"Longitude= " + ypin;

Toast.makeText( getApplicationContext(),

loca,

Toast.LENGTH_LONG).show();

}

@Override

public void onProviderDisabled(String provider){

Toast.makeText( getApplicationContext(),

"GPS Disabled",

Toast.LENGTH_SHORT ).show();

}

@Override

public void onProviderEnabled(String provider){

Toast.makeText( getApplicationContext(),

"GPS Enabled",

Toast.LENGTH_SHORT).show();

}

@Override

public void onStatusChanged(String provider, int status, Bundle extras){

}

}/* End of Class MyLocationListener */

}

接收启动完成的样本编码:

package com.schogini.SimpleTracker;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

public class MyIntentReceiver extends BroadcastReceiver {

// Called when boot completes

@Override

public void onReceive(Context context, Intent intent) {

// Set what activity should launch after boot completes

Intent startupBootIntent = new Intent(context, LaunchActivity.class);

startupBootIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

context.startActivity(startupBootIntent);

}

}

XML编码:(AndroidManifest.xml)

package="com.schogini.SimpleTracker"

android:versionCode="1"

android:versionName="1.0">

一些应用:

来自McAfee的WaveSecure

移动防御:

当心:

猎物:

盗窃意识:

wheresmyandroid

如果您已经丢失了电话,请向警察/网络部门投诉.您无法手动跟踪它.

建议购买类似的应用程序,以便有机会追踪您的手机并清除您的敏感数据.在此类应用程序中进行少量投资总是很方便的.

标签:android

来源: .html

发布评论

评论列表 (0)

  1. 暂无评论