Office Hours — Today, November 3

Saturday, October 31

Nov 3
8:50 AM
Mark M.
has entered the room
8:55 AM
Mark M.
turned on guest access
Matte
has entered the room
Mark M.
hello, Matte!
how can I help you today?
Matte
Hi there! Got your license yesterday, so expect to see me now and then :) First off, i have a couple of basic config-questions
Mark M.
go right ahead
though if somebody else joins, I'll take turns answering questions
Matte
Sure. Well, as you know, the android sdk is kind of volatile sometimes, so i've taken to doing stuff like this: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
9:00 AM
Matte
But, whaf if the app runs on an older phone, where the Build class doesn't have the JELLY_BEAN field? Is it part of the appcompat somehow? In intellij, i have to put the version up for it to not scream, but it seems to work in the phone anyway.... im just not sure why
Mark M.
"where the Build class doesn't have the JELLY_BEAN field? " -- that's an int, and so the value is inlined in the bytecode of your app
Matte
so you mean, as long as i compile it with a new enough version, it'll work?
Mark M.
correct
Matte
thanks! ofcourse... :)
Mark M.
JELLY_BEAN_MR2 needs to exist at compile time, but at runtime, it's the int value of that symbol that will be used
Matte
great, silly me.
ok, time for another?
Mark M.
go right ahead
Matte
right. Google Play Services! My app is kind of old, so i use maven still, havent gotten around to figuring out gradle. This means that i do this:
View paste
<dependency>
            <groupId>com.google.android.gms</groupId>
            <artifactId>play-services-location</artifactId>
            <version>8.1.0</version>
            <type>aar</type>
        </dependency>
for example
however, in intellij, it results in a directory with what looks like an entire sub-module/project is created in gen-external-apklibs with that dependency. Is this really how it should work?
Mark M.
well, I don't use the Maven build system, and I don't use IntelliJ
so, I can't really answer taht
er, that
Matte
np
just checking
9:05 AM
Mark M.
if you look inside an AAR file (it's a ZIP archive), you'll see a manifest, a resource tree like in a regular project, an assets tree like in a regular project, and a JAR
if what's in gen-external-apklibs looks like like that, it's probably just the unpacked AAR
Matte
seems to be something with the aar format. not sure how android packages that with my apk, but i guess i'll notice if it doesn't work
exactly
Mark M.
in Android Studio, you don't see the unpacked AAR by default -- you have to go hunting around the build/ directory for it
Matte
will it then pack that stuff back into my app when i build it? in intellij it is set up as a "module dependency"
Mark M.
presumably, yes
Matte
exactly, and add it yourself right
Mark M.
otherwise, their stuff is broken :-)
if we assume their stuff works, then the AAR contents are blended in with your app
it's probably just that you are "seeing the sausage being made" more in IntelliJ+Maven
Matte
right
Mark M.
the "apklibs" reference is from Maven's prior packaging of Android library projects into artifacts
they came up with their own approach, before Google debuted the AAR
Matte
right
yeah. well, i'll notice when i build. Still tons of stuff i apparently have to fix updating from LocationClient -> GoogleApiClient. Feels like yesterday i updated from the old locationclient to the fused one and now it's time again...
Mark M.
yes, they seriously revamped that API
my chapter on the fused location provider covers the latest stuff
including dealing with Android 6.0 runtime permissions
Matte
yeah speaking of that - there seems not to be any callbacks for disconnecting the client anymore?
Mark M.
I don't remember -- sorry
Matte
np mate
9:10 AM
Matte
but on that topic - i downloaded your omnibus, thought i'd save some time when im updating my geofencehandler from old to new - i couldn't find any geofence example?
Mark M.
sorry, I don't have any material on geofencing at the moment
Matte
no sweat, its ready, i just have to update to googleapiclient
well thats all i have for now, but for the future - the whole location thing is really hairy on android and i might have a couole of future discussion topics there... have you worked a lot with it?
Mark M.
some, less with the fused location provider, though
Matte
Yeah. Our app has been on the store for about three years. We're a small shop though, and i do android, ios, web and backend, so as you can imagine, sometimes there's some time between my android crunch times. However, we've always had more problems with location on android than ios
Mark M.
well, in terms of it being hairy, have you considered that what you thought was an Android device might really be a yak?
:-)
Matte
haha
9:15 AM
Matte
anyways, one example is that on android, we've had a recurring problem with the phone sometimes returning "old"/cached locations, but with updated timestamps, making it really hard to know whether to use the location. There are others with the same issue, so was just curious if you'd heard anything about it. It was the main driver for us moving to the fused provider
Mark M.
I haven't heard of that problem, at least with GPS_PROVIDER
Matte
There are a couple of similar SO threads, for example http://stackoverflow.com/questions/7648202/why-...
Mark M.
note that the SO question and its answer are kinda old
the half life of the value of an SO answer is about a year
Matte
yeah i know. There are a couple of threads that are newer, but youre right. We still see that issue sometimes though. Mostly on Samsung.
Mark M.
my needs for location data have been comparatively casual (e.g., when the user asks, make note of where we are now), so this sort of problem hasn't been an issue for me
Matte
Right. Our app is a lot about location and maps
Anyways, nothing more for now! Back to geofence coding... I might pop in at another time :) really like your book btw
Mark M.
as with lots of things in Android, once you get past simple scenarios, things get exponentially icky
9:20 AM
Mark M.
glad you like it!
Matte
indeed
you should see our "locationfetchservice" :)
anyways, have a good one!
Mark M.
you too!
Matte
has left the room
9:30 AM
Matt
has entered the room
Matt
Hi Mark, hope you are well.
Mark M.
hello, Matt!
how can I help you today?
Matt
I've got a quick question that i've pre-typed
View paste
I am contracting outside of normal office hours and writing and mobile device management system.
I've integrated Samsung Knox API (on your advice) into my app and now through push notifications i can toggle user settings(mobile data etc), change APN settings, lock down the settings app and remove apps remotely. 

My problem is the integration of the TeamVeiwer API. I have successfully integrated it and can create a TeamVeiwer session which remotely controls the phone from server.
The problem is the TV session only exists if my app is open. So i can't have full device control, eg go into settings app and turn on location.

I've been talking with teamveiwer and there maybe a work around as TeamVeiwer 11 is released today.

My question is do you know of any open source projects/ libraries that i can integrate in to android? 
I would like to not depend on teamveiwer as i don't think i may be able to fully, seamlessly integrate it into my solution.
My server application is written in dot net and is a web appliction so the library will need to communication between a web app and Android
9:35 AM
Mark M.
"do you know of any open source projects/ libraries that i can integrate in to android? " -- by definition, that's impossible, short of custom ROMs
the only reason TeamViewer would work is if Samsung put in hooks for TeamViewer
outside of that, you're limited to things like the accessibility and media projection APIs
and they are not capable of a TeamViewer-style remote-control mechanism
Matt
so i will be limited to what TV has to offer?
Mark M.
(actually, rooted devices could also offer remote access options, see VNC)
unless Samsung has alternatives to TV, and unless you're going the root or custom ROM route, pretty much yes
now, could you use accessibility and media projection to offer rudimentary remote support? yes
Matt
I won't be able to root the devices as the new customer will be buying brand new phones and prob will not want to root them
That sonds interesting
what is VNC and how could i get this going?
Mark M.
VNC is a long-standing remote access tool
been around for ~15 years or so
I know that there's a port for Android kicking around
however, it needs root, to be able to access the framebuffer, fake input events, etc.
that's basically the sort of low-level hooks that Samsung would have enabled for TeamViewer
9:40 AM
Mark M.
which IMHO kinda runs counter to the whole KNOX let's-lock-the-device-down logic, but, hey, I'm not Samsung :-)
Matt
There is a TV app called quick support that has all the functioality i need but i'm not sure if i can call it with my TV license details
Mark M.
yeah, you'd have to ask TV that
Matt
I wonder how companies like Soti and bomgar acheive this? the user installs there app and the server app can control the whole phone
the phones don't have to be rooted
just android 4.4 and that's it
Mark M.
"SOTI directly partners with over 70 mobile device manufacturers; we work very closely with the four largest Android device manufacturers that currently dominate the market"
basically, adb shell has elevated (though not root) access on production hardware
Matt
View paste
I've enrolled on the Samsung SEAP program and if my company get accepted i can become a Samsung partner.
Mark M.
there are some recipes floating around that leverage this to allow an app to take screenshots and fake input
Matt
does that mean i can liase with developers to get my system hooked with theirs?
9:45 AM
Matt
or when you said directly patner, do you mean something different?
Mark M.
I have no idea -- I'm just quoting their Web site
Matt
ok Thanks, i'm going to be talking to TV later tonight. i'll do some more digging on what they can offer.
9:50 AM
Matt
cheers bye for now.
Mark M.
have a pleasant day!
Matt
has left the room
9:55 AM
Mark M.
turned off guest access

Saturday, October 31

 

Office Hours

People in this transcript

  • Mark Murphy
  • Matt
  • Matte