Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,737,615 Members 45,764 Now Online
XDA Developers Android and Mobile Development Forum

[MOD][GUIDE] Disable Google Location consent dialog when enabling network location

Tip us?
 
nopainwithme
Old
#1  
Member - OP
Thanks Meter 12
Posts: 31
Join Date: Jul 2013
Default [MOD][GUIDE] Disable Google Location consent dialog when enabling network location

Hi, i find so annoying having to always tap "agree" when enabling Network location checkbox (i automatically enable it with a task together with GPS, when i need it) so I managed to obtain the same result of this Xposed module http://forum.xda-developers.com/xpos...nsent-t2449926, modifing directly the involved file system/app/NetworkLocation.apk of my JB 4.2.2 AOKP based rom (as in AOKP, CM roms you can't install Xposed Framework). tested 3 days on my JB 4.2.2 and using the app "Location test" from Google Play store. I'm sharing my knowledge.
---Always: test it yourself, at your own risk. I don't know if there are memory leaks (don't know exactly what they are but read about them ) or something else like unpredictable crashes. I'm not a developer and i just make small changes to smali code usually---

Instructions:

I took some hints from the source code of this Module and made changes to NetworkLocation.apk (thanks to the authors)

I used the tool dex2jar (https://code.google.com/p/dex2jar/downloads/list) (i find it useful for editing system apks).
Extract it in a folder.
It contains some batch files, you drag and drop files/folders into them and they make their work.
You can also use Apktool, if you prefer (be sure that the file decompiles without errors).

First of all: open NetworkLocation.apk taken from your rom and extract classes.dex (use 7-zip)
Drag and drop classes.dex into d2j-dex2jar.bat, a .jar file will be created. Then drag and drop the created .jar file into d2j-jar2jasmin.bat, a new jasmin folder will be created. Now open this folder and go to com-google-android-location and find 2 files: ConfirmAlertActivity.j and NetworkLocationProvider.j
These jasmin (.j) files are similar to .smali files,
Open them as text and edit as below (be sure to find and edit the correct pieces of code)(edit only the green numbers) :

A) ConfirmAlertActivity.j

1)

(.....)

iconst_1 (instead of iconst_0)
putfield com/google/android/location/ConfirmAlertActivity/mAgreed Z
(.....)

[smali code for those who are using apktool:

const/4 v0, 0x1

iput-boolean v0, p0, Lcom/google/android/location/ConfirmAlertActivity;->mAgreed:Z ]


2)

(.....)
L0:
iconst_1 (instead of iconst_0)
istore 3
goto L1
.limit locals 4

(.....)

[corresponding smali code:

.line 67
:cond_0
const/4 v0, 0x1 ]

B) NetworkLocationProvider.j


(....)
L0:
aload 0
iconst_1 (instead of iconst_0)
invokespecial com/google/android/location/NetworkLocationProvider/setUserConfirmedPreference(Z)V
return

(....)


[in smali:

.line 206
:cond_2

const/4 vX, 0x1 (where X is a number not used elesewhere in the method, for example: v10, v11, ...)

invoke-direct {p0, v6}, Lcom/google/android/location/NetworkLocationProvider;->setUserConfirmedPreference(Z)V ]


Finished!
Now do the inverse process: drag and drop the modified jasmin folder into d2j-jasmin2jar.bat, then the new .jar file into jar2dex.bat.
You will obtain a new classes-jar-blablabla-jasmin.dex file. Rename it classes.dex and use it to replace the classes.dex in the original NetworkLocation.apk (use 7-zip to open the.apk, Winrar might give problems).
Now you have your new NetworkLocation.apk without location consent dialog (automatically agreed). When you replace the old .apk, be sure that the new one has the same permissions of the old one.

I'm attaching the modified NetworkLocation.apk (version 1.1.10) of my android version: Rootbox JellyBean 4.2.2
These instructions won't work with Kitkat but should work at least with android 4.3.
Hope this is useful to someone that can't install this Xposed Module but want the same result!
Attached Files
File Type: apk NetworkLocation.apk - [Click for QR Code] (268.2 KB, 21 views)
 
tdunham
Old
#2  
tdunham's Avatar
Recognized Contributor
Thanks Meter 16095
Posts: 7,714
Join Date: Jun 2008
Location: TampaBay
Would you mind adding the .method headers where the 3 edits are located?
Or please provide stock apk so that I may diff the changes.
The code I am trying to adapt this to is for 4.4.2 and it is very different.
Tnx - TD
 
tdunham
Old
#3  
tdunham's Avatar
Recognized Contributor
Thanks Meter 16095
Posts: 7,714
Join Date: Jun 2008
Location: TampaBay
Nevermind, I figured it out. Here is the guide I did for 4.4.2 TW for the Galaxy S5.
http://forum.xda-developers.com/show....php?t=2798995
 
nopainwithme
Old
#4  
Member - OP
Thanks Meter 12
Posts: 31
Join Date: Jul 2013
Quote:
Originally Posted by tdunham View Post
Nevermind, I figured it out. Here is the guide I did for 4.4.2 TW for the Galaxy S5.
http://forum.xda-developers.com/show....php?t=2798995
Sorry for the delay, happy you solved it for kitkat!
The Following User Says Thank You to nopainwithme For This Useful Post: [ Click to Expand ]
 
budbay
Old
#5  
Junior Member
Thanks Meter 0
Posts: 9
Join Date: Jul 2014
Any more info on how to do this on 4.4, the thread was deleted.

Sent from my One X using XDA Free mobile app
 
tdunham
Old
#6  
tdunham's Avatar
Recognized Contributor
Thanks Meter 16095
Posts: 7,714
Join Date: Jun 2008
Location: TampaBay
Quote:
Originally Posted by budbay View Post
Any more info on how to do this on 4.4, the thread was deleted.
All of my 4.4.2 guide were moved here:

GALAXY S5 UNIFIED MODS THREAD - GUIDES & LINKS
 
budbay
Old
(Last edited by budbay; 13th July 2014 at 12:37 AM.)
#7  
Junior Member
Thanks Meter 0
Posts: 9
Join Date: Jul 2014
Thanks for the info. I am trying to reapply to HTC one x but I don't think I have the GmsCore.apk. I guess I'll keep searching.

Edit- I actually found PrebuiltGmsCore.apk that might be the equivalent

Sent from my One X using XDA Free mobile app

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Modernize Your Emails with Email Popup

SMS andHangouts messages likely won’t ever replace traditional Emails for more formal … more

Change Your Toast Notification Style with XToast

Android uses multipletypes of notifications. One of these isknown as a toast notification. … more

Port Sony Xperia Themes to CyanogenMod 11 with Ease

In addition the obvious proficiency with graphics, creating agood Android theme … more

Cell Phone SIM Unlock Bill Just Steps Away from President’s Desk

For all those who believe that Cinderella stories don’t actually … more