アンドロイドで位置を偽造したいです。アンドロイドには、PendingIntent
を使って場所を取得する方法があります。次に例を示しますとき、新しい場所の変更Xposed:PendingIntentを使用してメソッドをフックする方法
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
String proximitys = "ACTION";
IntentFilter filter = new IntentFilter(proximitys);
LocationReceiver mReceiver = new LocationReceiver();
registerReceiver(mReceiver, filter);
Intent intent = new Intent(proximitys);
PendingIntent proximityIntent = PendingIntent.getBroadcast(this, 0,
intent, PendingIntent.FLAG_CANCEL_CURRENT);
service.requestLocationUpdates("network", 1000, 0.001f, proximityIntent);
そしてBroadcastReceiver
がイベントを受信します:だから
public class LocationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//Do this when the system sends the intent
Bundle b = intent.getExtras();
Location loc = (Location)b.get(android.location.LocationManager.KEY_LOCATION_CHANGED);
}
}
、私は、このメソッドをフックしたいです。しかし、私はこの種の方法をフックする方法を知らない(それはPendingIntent
を使用している)。 PendingIntent
には「ある未来」のデータがあるため、いつ発生するのか分かりません。したがって、PendingIntent
にはまだデータがありませんので、方法requestLocationUpdates
の前と後の両方をフックすることは機能していないようです。
どうすればいいですか?