Does Google Maps My Location Work on the Diablotek D2?

jimc3

Member
Nov 5, 2012
39
4
When I touch the "My Location" icon in Google Maps, I eventually get "your current location is temporarily unavailable".

I've tried Google Maps v5.10.1 original from D2 Fixer as well as the latest Maps 6.14.1.

Settings / Personal / Location Services / Google's Location Service is checked.

Network Location v1.1.08 is in system/app with the correct permissions.

I also have:

/system/app/networklocation.apk
/system/etc/permissions/com.google.android.maps.xml
/system/framework/com.google.android.maps.jar
/system/framework/com.android.location.provider.jar

I have cleared data/cache in maps, turned off/on Google's Location Service, and turned off/on the tablet.

What Is My IP Address? Lookup IP, Hide IP, Change IP, Trace IP and more... returns the same correct location as does my Windows PC.

I have not tried (but should) to see if this works somewhere besides my house.

I'm trying to get Google Maps My Location to work with the minimum number of pieces.
I want to avoid installing all of Google Apps.

What am I missing?

Thanks,
Jim
 

leeb

Member
Jul 16, 2011
463
21
Unless that tablet has built-in GPS... you will need an external (like 3g or such) location-device. Your wifi will give it the location of the connection you are on, but once you leave a reception area... you are 'off the grid'.
 

jimc3

Member
Nov 5, 2012
39
4
Unless that tablet has built-in GPS... you will need an external (like 3g or such) location-device. Your wifi will give it the location of the connection you are on, but once you leave a reception area... you are 'off the grid'.

The D2 tablet is wifi-only and should be able to determine its location using LOCATION_COARSE. It is not as accurate as GPS, but better than nothing.

From SCRUFF support: https://support.scruffapp.com/entries/20068001-my-location-is-inaccurate-android-devices

Your Android device* determines and provides your location to SCRUFF based on a combination of the following:

GPS Satellite Triangulation - Very accurate, but works only outdoors and can take between several seconds to several minutes to establish a fix

Cell Tower Multilateration - Fast; works anywhere you have a cell signal; but accuracy is highly variable depending on signal strength and interference, distance from cell towers, obstacles, and the number of cell towers in range of your phone

WiFi Base Station Location - Fast; requires a WiFi connection; often very inaccurate

* WiFi-only tablet devices can only locate via WiFi Base Station. GPS will work on Android phones and 3G tablets without a data plan. A-GPS (assisted GPS), which uses the Internet in concert with GPS to more rapidly pinpoint your location, will work without a data plan as long as you have a WiFi connection.
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
I am using cm9 on d2pad I installed gapps to get location to work.

 
Last edited:

jimc3

Member
Nov 5, 2012
39
4
I am using cm9 on d2pad I installed gapps to get location to work.

I'm not sure I'm ready to replace the stock version with CM9 yet, if I can make minor modifications to the stock version.
I'm happy with the stock version, so far, but I can flash the device back to the stock version if I mess things up.

The stock framework-res.apk has these lines. I decompiled it with apktool.

31 <string name="config_networkLocationProvider">@null</string>
32 <string name="config_geocodeProvider">@null</string>

Would you know if the CM9 framework-res.apk contains these lines in res\values\strings.xml?

<string name="config_networkLocationProvider">com.google.android.location.NetworkLocationProvider</string>
<string name="config_geocodeProvider">com.google.android.location.GeocodeProvider</string>

Based on my Google searches regarding Maps My Location, this may or may not be part of the solution to my problem.
There are mixed opinions on whether this works.

Thanks,
Jim
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
I'm not sure I'm ready to replace the stock version with CM9 yet, if I can make minor modifications to the stock version.
I'm happy with the stock version, so far, but I can flash the device back to the stock version if I mess things up.

The stock framework-res.apk has these lines. I decompiled it with apktool.

31 <string name="config_networkLocationProvider">@null</string>
32 <string name="config_geocodeProvider">@null</string>

Would you know if the CM9 framework-res.apk contains these lines in res\values\strings.xml?

<string name="config_networkLocationProvider">com.google.android.location.NetworkLocationProvider</string>
<string name="config_geocodeProvider">com.google.android.location.GeocodeProvider</string>

Based on my Google searches regarding Maps My Location, this may or may not be part of the solution to my problem.
There are mixed opinions on whether this works.

Thanks,
Jim

I have uploaded the framework directory for you.

cm9_framework.zip
 

jimc3

Member
Nov 5, 2012
39
4
I decompiled your framework-res.apk and your strings.xml does contain:

<string name="config_networkLocationProvider">com.google.android.location.NetworkLocationProvider</string>
<string name="config_geocodeProvider">com.google.android.location.GeocodeProvider</string>

This might be what I need.

Thanks,
Jim
 

jimc3

Member
Nov 5, 2012
39
4
I decompiled your framework-res.apk and your strings.xml does contain:

<string name="config_networkLocationProvider">com.google.android.location.NetworkLocationProvider</string>
<string name="config_geocodeProvider">com.google.android.location.GeocodeProvider</string>

This might be what I need.

Thanks,
Jim

After changing strings.xml in framework-res.apk as described above, I am happy to say that My Location is working in Google Maps on the D2 Pad.

My current location is determined by my wifi location "Accurate to 20 meters" and gives the address of the house across the street.
Good enough for me for wifi-only.

Thanks vampirefo for the info from CM9. More details will follow for others who want this to work.

Jim
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
After changing strings.xml in framework-res.apk as described above, I am happy to say that My Location is working in Google Maps on the D2 Pad.

My current location is determined by my wifi location "Accurate to 20 meters" and gives the address of the house across the street.
Good enough for me for wifi-only.

Thanks vampirefo for the info from CM9. More details will follow for others who want this to work.

Jim

Good glad it worked for you.
 

jimc3

Member
Nov 5, 2012
39
4
The minimal Google Maps installation with a working "My Location" is described below.
I did not want the full Google Apps installation as I was happy with what came on the D2 Pad originally.
I want a tablet that is not cluttered with things I do not use, especially things that run the battery down.

For someone who has the full Google Apps, the changes to framework-res.apk will enable My Location in Google Maps
for the wifi-only D2 Pad. Changing framework-res.apk is the most difficult and dangerous part of this whole process
for someone like me who is new to Android.

*** So use these instructions at your own risk. Back things up and know how to restore your D2 Pad if something goes wrong. ***

Prior to these changes, I updated my D2 Pad with the download found at
DII PAD_WH.
Being able to do this update is one way to rescue the D2 Pad if you totally mess it up.


With these changes, my current location is the house across the street, based on the address shown in Google Maps.
My location, determined by wifi only, is "Accurate to 20 meters" according to Google Maps.
This is good enough for me.

Things that depend on current location are Maps (including Latitude, My Places, and Offers), Local, and Navigation.


The apks needed are:

framework-res.apk ICS v4.0.4 modified to use com.google.android.location

GoogleMap.apk Google Maps v6.14.1; com.google.android.apps.map
NetworkLocation.apk Network Location v1.1.08; com.google.android.location
GoogleServicesFramework.apk Google Services Framework v4.0.3-239410; com.google.android.gsf
GoogleLoginService.apk Google Account Manager v4.04-299849; com.google.android.gsf.login


According to other things I read, I think I needed these:

com.android.location.provider.jar
com.google.android.maps.jar
com.google.android.maps.xml


framework-res.apk is the original that was on the D2 Pad.

GoogleMap.apk is the latest version (6.14.1) from 1Mobile Market.

NetworkLocation.apk, GoogleServicesFramework.apk, GoogleLoginService.apk and the other files
came from Goo.im Downloads - Downloading gapps-ics-20120429-signed.zip.


The D2 Pad file locations are:

/system/framework/framework-res.apk

/data/app/com.google.android.apps-1.apk (after installing GoogleMap.apk as a user app)

/system/app/NetworkLocation.apk
/system/app/GoogleServicesFramework.apk
/system/app/GoogleLoginService.apk

/system/framework/com.android.location.provider.jar
/system/framework/com.google.android.maps.jar

/system/etc/permissions/com.google.android.maps.xml

Except for framework-res.apk, I use Root Explorer to copy things to /system and change their permissions to match other system files.


In order to modify framework-res.apk to use com.google.android.location to determine My Location,
framework-res.apk must be decompiled, editted, recompiled, then pushed back out to /system/framework.

I found general instructions for decompiling and recompiling at [team d.i.r.t] how to properly de/recompile apks on all android versions! - xda-developers.

However the tools I used are at apktools-ics - Minus (apktools-ics.zip).
This contains the 1.4.2 and 1.4.3 versions of apktool.jar.
I used the 1.4.2 version because the 1.4.3 versions did not work for me for the build.
My windows PC has the java runtime environment installed.


My c:\apktool contained:

aapt.exe 805kb
apktool.bat 1kb
apktool.jar 2614kb v1.4.2


The basic steps are:

1. copy original framework-res.apk calling it OLDframework-res.apk
2. copy original framework-res.apk to c:\apktool
3. java -jar apktool.jar if framework-res.apk (install framework)
4. java -jar apktool.jar d framework-res.apk frameres (decompile framework-res.apk)
5. edit for google location services (I used Notepad++)

Within framework-res.apk, two lines in res\values\strings.xml are changed from

<string name="config_networkLocationProvider">@null</string>
<string name="config_geocodeProvider">@null</string>

to

<string name="config_networkLocationProvider">com.google.android.location.NetworkLocationProvide r</string>
<string name="config_geocodeProvider">com.google.android.location.GeocodeProvider</string>


6. java -jar apktool.jar b frameres NEWframework-res.apk (recompile, creating NEWframework-res.apk)
7. rename NEWframework-res.apk to NEWframework-res.zip
8. rename OLDframework-res.apk to OLDframework-res.zip
9. copy META-INF folder and the AndroidManifest.xml from the OLDframework-res.zip to NEWframework-res.zip (I used 7-zip)
10. rename NEWframework-res.zip to framework-res.apk


To push the new framework-res.apk to /system/framework/ I used the instructions at
Install ADB and Fastboot on your Windows computer | Team Nocturnal.
The files needed are at http://team-nocturnal.com/files/Android/apps/adb_fastboot_and_other_tools.zip.
This YouTube video is helpful for a novice like me.
Pushing a bad framework-res.apk to your D2 Pad is the most dangerous part of this whole process
and the YouTube video explains how to get out of a mess using ADB. You can push your old good
framework-res.apk to your D2 Pad and reboot.

After unzipping the files to C:\Android on my Windows PC, the basic steps are:

1. put the new framework-res.apk in C:\Android
2. execute cmd.exe
3. navigate to C:\Android
4. adb push framework-res.apk /system/framework/
5. adb shell chmod 644 /system/framework/framework-res.apk
6. adb reboot

Note: I had to set up my gmail account again for the supplied email app.


Descriptions of other apk files:

GoogleMap.apk
The main app.

NetworkLocation.apk
Provides the current location for My Location.

GoogleServicesFramework.apk
I discovered NetworkLocation.apk alone was not enough.
ADB LOGCAT contained the message "Failed to find provider info for com.google.android.gsf.services",
so this GSF apk was needed as well.

GoogleLoginService.apk
ADB LOGCAT messages for Google Maps / Settings indicated I was missing this apk.
Enables items in maps pull-down, such as settings, and latitude.


Other things I noticed:

When using the supplied browser, a new google account is setup.
This is in addition to the gmail account I set up for the supplied email app.

Settings / personal / location services contains:
Google's location service
Location & Google Search
(I checked both of these)

Settings / personal / backup & reset / Backup my data (to google services) checkbox is new.

Upon startup, settings / device / apps / running shows:
Maps 1 process and 1 service
Google Services 1 process and 2 services


I'm not sure if this is new:
settings / system / about tablet / system updates

This is my first tablet and my first venture into modifying one, so any helpful comments are welcome.

Good luck and be careful,
Jim
 
Last edited by a moderator:

WoweeRobert

Senior Member
Dec 29, 2011
23
0
What about battery Life with this tablet? I want to know because I am very interested in this tablet, but want to avoid plugging the thing in every time I play angry birds for 20 minutes.

Thanks
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
What about battery Life with this tablet? I want to know because I am very interested in this tablet, but want to avoid plugging the thing in every time I play angry birds for 20 minutes.

Thanks
Battery lasts about 5 to 6 hours.
 

myfishbear

Senior Member
Nov 12, 2012
118
50
can you send me your modded file jim... im having trouble recompiling with apktool i would appreciate it greatly(win 7 and java 7 are not playing nicely for me and i got to wait for my gf to give me her busted laptop so i can load ubuntu on it)
-nm i got it working lol
 
Last edited:
Top