看板 Soft_Job 關於我們 聯絡資訊
看到 LocationManager 大家可能都可以猜到我想幹嘛 Fack GPS之類的APP都是透過 Mock Location去達到改變位置的效果 我就想從LocationManager 去著手,想從GPS晶片上來的路中做修改。 目前研究到 LocationManager有綁定到一個名為 LocationManagerService的物件 中間的介面為 ILocationManager 在LocationManager裡有一個mService物件 形態為ILocationManaer 從別人的分析中找到 這個Interface中有一個很重要的Method是 reportLocation 對應於 gps_location_callback 也就是從他開始把GPS位置往上傳遞到各個 LocationListener 幾個關鍵方法 ListenerTransport transport = wrapListener(listener, looper); //其中的一個function @Override public void onLocationChanged(Location location) { Message msg = Message.obtain(); msg.what = TYPE_LOCATION_CHANGED; msg.obj = location; mListenerHandler.sendMessage(msg); } mService.requestLocationUpdates(request, transport(上面的物件), intent, packageName); mService中 public void reportLocation(Location location ,boolean){ //略過部分 if(mContext.checkCallingOrSelfPermission( INSTALL_LOCATION_PROVIDER )!=PcakagerManager.PERMISSION_GRANTER){ throw new SecurityException("Requires INSTALL_LOCATION_ PROVIDER permission") } Message m = Message.obtain(mLocationHandler,MESSAGE_LOCATION_CHANGED,location); } 由此得知,透過reportLocation 可以將坐標傳往所有註冊的locationlistener 不過當我找到 reportLocation 並且呼叫他之後 出現了 Requires INSTALL_LOCATION_PROVIDER permission 也就是上面那個IF的內容QQ 那我現在是改成找到Handler ... 並且Message m = Message.obtain(mLocationHandler,MESSAGE_LOCATION_CHANGED,location); 成功的機會比較大嗎QQ (苦惱 避免誤會 我的權限內有加上 <uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER"></uses-permission> -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.33.232 ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1470856813.A.F88.html ※ 編輯: mouse21 (220.132.33.232), 08/11/2016 03:29:24
galic: 怎不發在Android開發版 08/11 09:18
hicoy: 有root嗎?或者是system app嗎? 08/11 10:23
ssccg: 有些權限你必須是系統app才有用,自己加了也沒用 08/11 11:58
y3k: 你有要權限 不代表別人會給你 08/11 12:25
willyp: 可以查系統定義這permission的權限 我看好像是 08/11 23:19
willyp: signature|privileged 你自己寫的ap應該無法跟他sign同樣 08/11 23:20
willyp: 的key // Not for use by third-party applications 08/11 23:20
jiahansu: location service是透過ipc跟其他的app互動的,跟摟主 08/12 19:01
jiahansu: 的app不是在同一個process,這樣做根本沒用。 08/12 19:01
kimmyariel: 要直接改android framework才有用吧? 08/14 15:06