【实例简介】

【实例截图】

【核心代码】

package com.markypq.gpshook;

import android.Manifest;

import android.annotation.TargetApi;

import android.app.Activity;

import android.content.ClipData;

import android.content.ClipboardManager;

import android.content.Context;

import android.content.Intent;

import android.content.SharedPreferences;

import android.content.pm.PackageManager;

import android.location.Criteria;

import android.location.Location;

import android.location.LocationListener;

import android.location.LocationManager;

import android.net.Uri;

import android.os.Build;

import android.os.Bundle;

import android.os.IBinder;

import android.support.v7.app.AppCompatActivity;

import android.util.Log;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.widget.CheckBox;

import android.widget.EditText;

import android.widget.TextView;

import android.widget.Toast;

import java.lang.reflect.Field;

import java.util.HashMap;

import java.util.Random;

import de.robv.android.xposed.XSharedPreferences;

import de.robv.android.xposed.XposedBridge;

public class MainActivity extends AppCompatActivity {

TextView tv;

EditText lan, lon,acc;

CheckBox enableHook;

TestLocationListener mlistener = new TestLocationListener();

LocationManager locationManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

tv = (TextView) findViewById(R.id.show);

lan = (EditText) findViewById(R.id.lan);

lon = (EditText) findViewById(R.id.lon);

acc= (EditText) findViewById(R.id.acc);

enableHook = (CheckBox) findViewById(R.id.enableHook);

initView();

locationManager = (LocationManager) MainActivity.this.getSystemService(Context.LOCATION_SERVICE);

getLocation(null);

}

@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

if (requestCode==0x01&&resultCode==Activity.RESULT_OK){

SharedPreferences sp = getSharedPreferences("markypq", MODE_WORLD_READABLE);

SharedPreferences.Editor e = sp.edit();

e.putString("lan", data.getDoubleExtra("lan",0) "");

e.putString("lon", data.getDoubleExtra("lon",0) "");

e.commit();

initView();

}

super.onActivityResult(requestCode, resultCode, data);

}

private void initView() {

SharedPreferences sp = getSharedPreferences("markypq", MODE_WORLD_READABLE);

lan.setText(sp.getString("lan", ""));

lon.setText(sp.getString("lon", ""));

acc.setText(sp.getString("acc",""));

enableHook.setChecked(sp.getBoolean("enableHook",true));

}

@TargetApi(23)

public void getLocation(View view) {

if (Build.VERSION.SDK_INT >= 23)

if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {

// TODO: Consider calling

// Activity#requestPermissions

// here to request the missing permissions, and then overriding

// public void onRequestPermissionsResult(int requestCode, String[] permissions,

// int[] grantResults)

// to handle the case where the user grants the permission. See the documentation

// for Activity#requestPermissions for more details.

return;

}

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 200, 1, mlistener);

String bestProvider = locationManager.getBestProvider(getCriteria(), true);

Location location = locationManager.getLastKnownLocation(bestProvider);

if (location != null)

tv.setText(location.getLongitude() "|" location.getLatitude());

/* try {

Field localField = Class.forName("android.os.ServiceManager")

.getDeclaredField("sCache");

localField.setAccessible(true);

HashMap map = (HashMap) localField.get(null);

for (String s:map.keySet()){

Log.d("local",s map.get(s).toString());

}

}catch (Exception e){

}*/

}

public void save(View view) {

SharedPreferences sp = getSharedPreferences("markypq", MODE_WORLD_READABLE);

SharedPreferences.Editor e = sp.edit();

e.putString("lan", lan.getText().toString());

e.putString("lon", lon.getText().toString());

e.putString("acc",acc.getText().toString());

e.putBoolean("enableHook",enableHook.isChecked());

e.commit();

Toast.makeText(this, "保存成功", Toast.LENGTH_SHORT).show();

// getLocation(null);

}

public void change(View view) {

if (Build.VERSION.SDK_INT >= 23)

if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {

// TODO: Consider calling

// Activity#requestPermissions

// here to request the missing permissions, and then overriding

// public void onRequestPermissionsResult(int requestCode, String[] permissions,

// int[] grantResults)

// to handle the case where the user grants the permission. See the documentation

// for Activity#requestPermissions for more details.

return;

}

locationManager.removeUpdates(mlistener);

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 200,1, mlistener);

}

public void map(View view) {

Intent intent =new Intent(MainActivity.this,MapActivity.class);

SharedPreferences sp = getSharedPreferences("markypq", MODE_WORLD_READABLE);

double latitude = Double.valueOf(sp.getString("lan","117.536246"));

double longtitude = Double.valueOf(sp.getString("lon","36.681752"));

intent.putExtra("lan",latitude);

intent.putExtra("lon",longtitude);

startActivityForResult(intent,0x01 );

}

private class TestLocationListener implements LocationListener {

@Override

public void onLocationChanged(Location location){

//当位置发生改变时调用

tv.setText("经度: " location.getLatitude() " ,纬度: " location.getLongitude());

}

@Override

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

}

@Override

public void onProviderDisabled(String provider){

//当适配器禁用时调用

}

@Override

public void onProviderEnabled(String provider){

//当适配器有效时调用

}

public void onStatusChanged(String provider){

//当状态改变时调用

}

}

/* * 返回查询条件

*

* @return

*/

private Criteria getCriteria() {

Criteria criteria = new Criteria();

// 设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细

criteria.setAccuracy(Criteria.ACCURACY_FINE);

// 设置是否要求速度

criteria.setSpeedRequired(false);

// 设置是否允许运营商收费

criteria.setCostAllowed(false);

// 设置是否需要方位信息

criteria.setBearingRequired(false);

// 设置是否需要海拔信息

criteria.setAltitudeRequired(false);

// 设置对电源的需求

criteria.setPowerRequirement(Criteria.POWER_LOW);

return criteria;

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

getMenuInflater().inflate(R.menu.menu_main,menu);

return super.onCreateOptionsMenu(menu);

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

switch (item.getItemId()){

case R.id.setting:

case R.id.about:

try {

String url="mqqwpa://im/chat?chat_type=wpa&uin=2039609991";

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));

}catch (Exception e){

ClipboardManager myClipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);;

myClipboard.setPrimaryClip(ClipData.newPlainText("text", "2039609991"));

Toast.makeText(MainActivity.this,"作者QQ已经复制",Toast.LENGTH_SHORT).show();

}

break;

case R.id.donate:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("HTTPS://QR.ALIPAY.COM/FKX04652BHHIVRVZIABFB1".toLowerCase())));

break;

}

return super.onOptionsItemSelected(item);

}

}

xposed定位插件_GpsHook实现模拟定位,手机需安装Xposed类框架相关推荐

  1. 手机模拟器安装Xposed框架

    如何在手机模拟器上安装xposed呢? 工具准备: 1.手机模拟器(以雷电模拟器为例子) 2.FQ软件 3.xposedinstaller 安装过程: 1.下载一个豌豆荚(别的应用市场也可以) 2.搜 ...

  2. xposed定位插件_模拟位置xposed

    模拟位置xposed软件是一款专门为用户们提供超多精准定位服务软件.还可以直接利用缩小地图以及搜索实现更多全球的搜索模拟等定位.在这里利用全新的加密通道不断的去保护用户们的所有网络信息,避免许多的网络 ...

  3. 厉害!我的真我realme手机成功安装谷歌服务框架Google Play商店,安装谷歌三件套,超级简单

    刚到手realme真我X2 Pro手机.马上去到百度搜索下载安装谷歌play商店.我万万没有想到,我这么聪明的人居然被骗了59块钱.我在开始的时候,我尝试自己安装谷歌,但是安装出现了闪退,无法联网等毛 ...

  4. XPosed及插件安装(解决下载http://dl.xposed.info/repo/full.xml.gz时出错的问题)

    文章目录 1. 按 2. 软件及环境 2.1. 客户端 2.2. 服务器端 2. 操作步骤 2.1. Charles部分 2.2. Xposed部分 1. 按 本文将介绍如何在小米4手机上安装XPos ...

  5. 最新!魅族、魅蓝手机安装Xposed框架的最新方法!亲测有用!

    很久很久以前,我分享过一个关于魅族魅蓝系列手机怎样安装Xposed框架的教程<魅族手机获取root权限.安装Xposed框架的方法!>.<魅族.魅蓝系列安卓手机安装Xposed框架详 ...

  6. [1035]xposed框架未安装xposed模块未激活怎么办(Could not load available ZIP files.Pull down to try again)

    文章目录 xposed框架未安装xposed模块未激活 Could not load available ZIP files.Pull down to try again 前言 步骤说明 注意点 雷电 ...

  7. 【原创】【2021 android逆向系列】2:MIUI安装xposed问题全览(从本人简书博客移入)

    书接上文[原创][android逆向系列]1:真机(小米note 3)root,本文和大家说一说MIUI安装xposed爬过的坑,以及如何安装xposed~ 一.xposed基础知识: xposed ...

  8. 最新2021修复安装了谷歌框架GMS后华为/荣耀手机FCM推送服务仍不能用的问题(Microsoft Authenticator微软验证器在安装了Google服务后还是提示不可用)

    简介 Firebase Cloud Messaging (FCM) 是 Google Cloud Messaging (GCM) 的升级版,是一种便于在移动应用和服务器应用程序之间进行消息传递的云推送 ...

  9. android xposed 简书,Xposed开发插件环境配置

    1.VirtualXposed VirtualXposed 是基于VirtualApp 和 epic 在非ROOT环境下运行Xposed模块的实现.允许在非Root得环境下使用Xposed框架,实现对 ...

最新文章

  1. 使用脚本完成AutoCAD自动化任务课程
  2. 实践 Network Policy - 每天5分钟玩转 Docker 容器技术(172)
  3. 【Android FFMPEG 开发】FFMPEG 获取 AVStream 音视频流 ( AVFormatContext 结构体 | 获取音视频流信息 | 获取音视频流个数 | 获取音视频流 )
  4. error: a label can only be part of a statement and a declaration is not a statement
  5. learnpython3thehardway视频_LearnPython3theHardWay__Excercise 13 Parameters, Unpacking, Variables
  6. jdk12 jdk1.8_JDK 12的Files.mismatch方法
  7. linux格式化usb设备,如何在 usb linux下格式化磁盘
  8. Git 分支相关操作
  9. python内置函数可以返回数值型序列中所有元素之和_Python内置函数________________用来返回数值型序列中所有元素之和。...
  10. 杰里之混响音效调试【篇】
  11. 【娜家花园养花小记】
  12. mysql临时表关联查询_MySQL如何执行关联查询
  13. 因严重 OpenSSL 漏洞,Fedora 37 推迟至 11 月中旬发布
  14. matlab 电路频率响应_频率响应法与matlab指令计算
  15. 怎么注销百度云服务器账号,百度网盘怎么注销账号?账号注销方法一览
  16. 实用计算机相关日语词汇,日语分类词汇:计算机类(1)
  17. Matplotlib 实战总结,超全!超长!
  18. AEJoy —— 彻底搞懂 AE 各种 loop* 表达式【二】
  19. java植物大战僵尸 论文_java实现植物大战僵尸游戏
  20. 【蓝桥杯国赛真题20】Scratch纸牌对对碰 青少年组 scratch蓝桥杯国赛真题和答案讲解

热门文章

  1. python类型属于对象,不属于变量
  2. 污水治理智能化管理解决方案
  3. 【RDMA】12. RDMA之Verbs|OFED
  4. 阶段性总结:复旦微的FMQL10S400ZYNQ芯片+国微SM25QH256MX的FLASH的使用感受
  5. @Transient----------------springMVC
  6. 朝着先能干活的方向努力。。。奥利给!!!20
  7. 基于GR551x芯片的硬件IIC驱动QMA7981
  8. Cesium深入浅出之可视域分析
  9. c语言输出手机号是负的是怎么回事,找出正确手机号码
  10. 山东大学软件学院项目实训weblab-1