If you are trying to integrate Waze with other Android apps (like Tasker) you will eventually try to launch Waze navigating to an address. Numerous places online show us that these URIs work:
That last example may get you thinking… I know it did for me. What about navigating to the “Home” or “Work” locations that the app set up? Surely you can just type those in as your query and Waze will be smart enough to figure it out, right?
Nope. It looks for a business named “Home” or “Work” nearby. No amount of wrangling could get it to work for me. But since I could open the app up and type Home into the search box I figured that Waze must have some built-in way to figure out if a search string is a Home/Work/Favorite versus something to search on the map for.
Navigate into downtown Waze
I decompiled the apk and discovered that Waze sends the URI down into a native code function, which makes it harder to reverse engineer. As in, I’m not even going to bother because then I’d have to teach myself assembly. So I cheated. I ran
strings against libwaze.so (native code included in the Android app) to find pieces of strings which may be used to test a supplied URI and found this:
Shell
0
1
2
3
4
5
6
decode:valid lat%s
decode:valid lon%s
Received invalid lon/lat
decode:valid zoom%s
favorite=
WIDGET_DRIVE
navigate=yes
Oh ho ho! Some of these strings are probably used in debugging statements (decode: valid lat %s), and maybe ‘favorite=’ is too. But let’s just try a few things.
It works for your saved ‘Home’ and ‘Work’ locations. It also works for any place you’ve saved as a favorite. Just substitute the name you used. So feel free to set up Tasker tasks to automatically navigate all over the place.
Create a bash/cmd script at each end to break the file into pieces with dd.
md5sum each piece at both ends and compare to figure out which chunks are bad
transfer the bad chunks from source to target
dd the chunks back into the giant file
recheck the md5sum of the file to make sure it matches
Create a bash/cmd script at each end to break the file into pieces
Tip: rename the file to something which doesn’t require escape sequences, especially if your source/target are running different OSes. For example, spaces mean the name has to be enclosed in quotes on Windows and have a backslash prepended on Linux. So get those spaces out of there.
dd thinks in terms of blocks.
I set the blocksize to 1 megabyte to make the math easier. I want each chunk to be 128MB. The size of the chunk is up to you, but the trade-off is waiting for excess data to transfer versus dealing with more part files. Anyhow, we have
bs=1048576count=128 .
To tell
dd where to start when it’s copying data out of a file, supply the skip option. So the first chunk has
skip=0 , the second chunk has
skip=128 , the third has
skip=256 , and so on. Why?
dd thinks in terms of blocks.
I usually create an Excel workbook and use fill-down to create the correct skip numbers and then
CONCATENATE() to create the actual dd command lines. Copy and paste them into a text document. Send it to both ends with the correct extensions/permissions/shebang line/etc.
Here’s how I set up my excel sheet to create my batch/shell scriptThe formulas allow me to fill down to create the correct lines in my batch/shell script
Run the batch/shell script at each end to create corresponding partXXXX files. If you follow my example, the value in the K column shows you where to stop copying; it changes to false at the line where you’ve passed the final dd required.
md5sum the pieces at each end and compare
Pretty easy; use
md5sum on all of the partXXXX files at each end. Save the output into an md5 file and then get both files in the same place so you can compare.
md5sum all of the pieces
Shell
0
md5sum part*>part.md5
Using the command line
diff tool will work, but if you have a GUI tool it should make it easier to see which files don’t match. Let’s hope there aren’t many.
Transfer the bad chunks from source to target
This part should be easy; just send the good chunks from the source to the target to replace the bad chunks. To make sure you haven’t wasted your time,
md5sum the replacement chunks once they reach the destination. Re-retransfer any that don’t match.
dd the chunks back into the giant file
We will use
dd again. Instead of redoing the whole process in reverse, we only need to dd in the fixed chunks.
Either redo your Excel sheet or just find and replace in your target batch/shell script.
The key things here are that the
if and
of have been swapped, we must add
conv=notrunc, and we use
seek instead of
skip. We swap the input and output files because we’re outputting to the big file. We use
conv=notrunc because by default dd will truncate the destination file at the point where you start writing. We don’t want to destroy the file, so this is important. Finally, when we need to write the destination file anywhere other than the start, we have to use
seek instead of
skip .
You only need the lines corresponding to the fixed chunks. So your final batch/shell script might end up looking like this:
So somewhere along the way we all grew up. Part of growing up is not visiting websites named ‘bellybuttonporn.com’ any more. So many of you never saw this. Now seemed as good as any time to copy the old post and images into this blog for our more modern sensibilities. I had to change the links for the comparison cars; they fell victim to linkrot after a model year had passed. At then end I’ll be back with an update. Continue reading Buying the Magnum