안드로이드에서 위치를 가짜로 만들고 싶습니다. 안드로이드에서는 PendingIntent
을 사용하여 위치를 얻는 방법이 있습니다.Xposed : PendingIntent를 사용하여 메서드를 후킹하는 방법
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);
}
}
그래서, 나는이 방법을 훅하려면 : 새 위치 변경시
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
이벤트를 받게됩니다 예를 들면 다음과 같습니다. 그러나 나는 이런 종류의 방법을 연결하는 방법을 모른다 (즉 PendingIntent
사용). PendingIntent
은 "미래의 미래"에 데이터를 가지고있을 것이고 언제 일어날 지 모른다. 따라서 메서드 requestLocationUpdates
의 전후에 후킹은 그 당시에는 PendingIntent
에 아직 데이터가 없기 때문에 작동하지 않는 것 같습니다.
어떻게하는지 알려주세요.