Office Hours — Today, April 18

Thursday, April 16

Apr 18
3:50 PM
Mark M.
has entered the room
Mark M.
turned on guest access
3:55 PM
Howard
has entered the room
Mark M.
hello, Howard!
how can I help you today?
Howard
View paste
Hi Mark,
I have written a private geocaching app which displays a Map (Open Street Map (OSM) or Google Map), automatically shows the nearest cache and automatically zooms as the user approaches the cache. When the user scroll gestures or zoom gestures, the app needs to detect the gesture and disable the auto zoom and auto scroll.

On an OSM map, this is easy to do with .setGestureDetector() and .setOnTouchListener().
Google Maps(GM) doesn't appear to expose either one and a search of stackoverflow doesn't find any alternatives.

First question: GM does expose .OnCameraMoveStartedListener, .OnCameraMoveListener and .OnCameraIdleListener. While .OnCameraMoveListener and .OnCameraIdleListener are Unit functions, .OnCameraMoveStartedListener returns (int) REASON_GESTURE - Camera motion initiated in response to user gestures on the map. I am using this to turn off auto zoom and auto scroll but I have to turn off both. Since Google Maps v3 is in beta, I am thinking of asking Google to add REASON_PAN and REASON_ ZOOM to  .OnCameraMoveListener. Would appreciate your thoughts on this idea and how does one ask Google to do this?
Ed T.
has entered the room
Mark M.
(BTW, hello Ed! I will be with you shortly!)
Howard: in terms of your idea... you have done a lot more work with the Google Maps API than I have in the past 18 months :-)
so, I cannot say whether your idea is good or not
in terms of how to make this suggestion to Google... do they have any feedback forms for the v3 beta? if so, try that
4:00 PM
Howard
I haven't found any feedback forms but will keep looking.
Mark M.
while I make lots of recommendations for Android itself, I don't work a lot with Google proprietary bits, and I do not recall ever filing a feature request for one
so, I haven't the foggiest notion where to really look for one
Howard
Thanks.
Mark M.
sorry that I'm not well-suited to help with this subject!
let me take a question from Ed, and I'll come back to you in a bit
Ed: your turn! how can I help you today?
Ed T.
Mark I'm trying to do IPP printing from Android
If you know of CUPS then you know what I'm asking
Mark M.
I'
I'm a Linux user and have some familiarity with CUPS
(mostly in the form of streams of profanities while I try to get a new printer set up...)
Ed T.
So I used IntelliJ IDE to set this up... https://github.com/harwey/cups4j
I was able to do what I needed and test
I also used iptool to print and that worked fine
4:05 PM
Ed T.
so I ported it to Android
4:05 PM
Ed T.
compiled
and thought I was golden until I realized the apache libs are not supported in Android
Mark M.
which Apache libs are you referring to?
Ed T.
View paste
    java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes2.dex)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)
View paste
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)
        at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:966)
        at com.dnp.iam.wcmtestprint.cups4j.operations.IppOperation.sendRequest(IppOperation.java:158)
        at com.dnp.iam.wcmtestprint.cups4j.operations.IppOperation.request(IppOperation.java:55)
        at com.dnp.iam.wcmtestprint.cups4j.CupsPrinter.print(CupsPrinter.java:154)
        at com.dnp.iam.wcmtestprint.cups4j.client.Cups.print(Cups.java:170)
        at com.dnp.iam.wcmtestprint.MainActivity.printRulerImage(MainActivity.java:52)
        at com.dnp.iam.wcmtestprint.MainActivity.access$000(MainActivity.java:21)
there is a bunch of weird stuff I have to put into the HTTP header
Mark M.
AllowAllHostnameVerifier would give you additional problems, in the form of being banned from the Play Store, if that's how you were planning on distributing your app
there is a standalone Apache HttpClient library for Android: https://hc.apache.org/httpcomponents-client-4.5...
I haven't tried one in years
Ed T.
I tried that and it has duplicates with the Android library
compiler goes bonkers
it seems like I could get away with just an HTTP PUT on port 631 but the secret sauce in the header is not apparent to me
I have a wifi server with cups on it and I was able to run mDNS and see all of the services
4:10 PM
Mark M.
there is at least one project out there trying to do IPP via OkHttp: https://github.com/alexvanboxel/iotope-print
Ed T.
So you are not aware of any app that does ipp or cups style printing from Android?
Mark M.
it's old (~5 years)
Ed T.
IPP is older... :D
Mark M.
the GitHub repo is advertised as a port of cups4j to Android
Ed T.
thanks for the info! I appreciate you
Mark M.
however, it implements a print service; it's not a library on its own, if I understand what I'm reading correctly
let me switch back to Howard, and I'll return to you shortly
Howard: back to you! do you have another question?
Howard
The geocache app that I mentioned doesn't use Navigation but I am thinking of playing with it. The google docs imply a main fragment like Goggle's Sunflower app. Im my app, the different maps are all fragments but the user can move from one to another by clicking buttons so there is no main fragment. My very limited understanding of Navigation is that my app is not a good match. Will navigation allow a rotating group of fragments instead of a main fragment?
Mark M.
Navigation wants some fragment to be "home", which could simply be "whatever you want to show the user first"
and, even with your group of fragments, something has to come first
4:15 PM
Mark M.
if that is knowable at compile time, Navigation should work
if OTOH you don't know what the first fragment is until runtime, then Navigation isn't really a good fit
Howard
Yes, but the user can set the startup map. I thought of picking one as a startup which can be hidden. Might that work?
Mark M.
it's possible that would work
there's probably a recipe for this, along the lines of the conditional navigation recommendations (https://developer.android.com/guide/navigation/...)
and if not, there should be, because what you are describing is not that uncommon
Howard
If one map can then call another map which can call previous or a new map, will Navigation handle this case?
Mark M.
if you are willing to set up the actions, yes
Howard
Thanks for that link - I hadn't read it yet.
Mark M.
that's for other conventional "hey, I might show X or Y" scenarios, and it may give you some ideas for how to proceed
4:20 PM
Howard
Thanks again Mark. I'm a retired 70+ who has learned Android and Kotlin thanks to your books.
Mark M.
very cool!
Howard
has left the room
Mark M.
oh, well -- I was going to make an additional recommendation, but I was taking too long for the research...
Ed T.
neat! I feel young at 55 :-)
Mark M.
mDNS is the bane of my existence on a project that I am working on now
Ed T.
I got that app to work on Android that this guy has in Github.... fun because you can see all of the 'network aware' devices in your house.
Mark M.
yeah, well, that depends a lot on your router
on this project, we're having to use other stuff to supplement mDNS, because mDNS isn't proving to be reliable (for Android or iOS clients)
Ed T.
iOS app 'Discovery' is amazing
they have a desktop version as well... super cool what you can see
I was able to get that to run on Android
it wraps the mDNS C library via JNI stubs for java
hang in there! I'm sure you will figure it out.
Have a great day. I'm off to get a printer to work. :-)
Mark M.
hope you have a hammer handy! :-)
Ed T.
lol
Hammer Time.... can't touch this
4:40 PM
Ed T.
has left the room
4:55 PM
Mark M.
turned off guest access

Thursday, April 16

 

Office Hours

People in this transcript

  • Ed T.
  • Howard
  • Mark Murphy