Sep 22 | 3:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
PPartisan | has entered the room |
Mark M. |
hello, PPartisan!
|
Mark M. |
how can I help you today?
|
PPartisan |
Good afternoon Mark :)
|
PPartisan |
I put a question up on StackOverflow a couple of days ago but it hasn't received much attention, would you mind if I paste it in for you to take a look at?
|
Mark M. |
sure
|
PPartisan | |
Mark M. |
though you also have the Stack Overflow "bump" service as part of your Warescription
|
Mark M. |
you don't need to wait for chats
|
Mark M. |
and since I have never used AppBarLayout, I have no means of really helping you
|
PPartisan |
Ahh :)
|
Sep 22 | 4:00 PM |
PPartisan |
The question is really concerned with the status bar in Lollipop, and how it seems to act as an overlay rather than as a solid part of the layout
|
Mark M. |
I'll take your word for it that it is
|
Mark M. |
I have never looked into that point
|
Mark M. |
sorry
|
PPartisan |
No problem - I'll fill out an application for a bump
|
Mark M. |
well, there is no point in bumping this specific question
|
Mark M. |
I'd just post in comments more or less what I said here
|
PPartisan |
Ok
|
Mark M. |
if you have another question, go right ahead
|
Sep 22 | 4:05 PM |
PPartisan |
No I do'nt thanks, I'll be back within the hour if I think of one!
|
Mark M. |
OK
|
Sep 22 | 4:15 PM |
EGHDK | has entered the room |
EGHDK |
Hey Mark
|
Mark M. |
oh, hey EGHDK
|
Mark M. |
how can I help you today?
|
Mark M. |
(sure wish this chat would beep when somebody entered...)
|
EGHDK |
Hahah. Just got in!
|
EGHDK |
A couple of questions that I can hopefully just ring off of ya. 1. Do widgets need a content provider to show my apps database data?
|
Mark M. |
no
|
Mark M. |
app widgets, like activities, are not tied to having a ContentProvider
|
Mark M. |
you can use one, but there is no particular magic that says "app widgets need a ContentProvider"
|
Sep 22 | 4:20 PM |
PPartisan | has left the room |
EGHDK |
Heh. I'm trying to make a widget, and I am using my content provider. But trying to use it throws an exception that the provider is not exported.
|
EGHDK |
Ideas?
|
Mark M. |
that's odd
|
Mark M. |
can you post your stack trace?
|
EGHDK |
Sure let me pastebin it
|
EGHDK | |
Mark M. |
does your <service> that is supplying the RemoteViewsFactory have an android:process attribute on it?
|
EGHDK |
I'm working on someone elses sample repo. So I'm jumping right into it, but I added the widget, and when I put an exported flag in the manifest for the provider it works.
|
Mark M. |
yeah, but by default, that means the provider is wide open and unsecured
|
Mark M. |
you only want to export the provider if a third-party app is supposed to be using it
|
Sep 22 | 4:25 PM |
EGHDK |
yeah.
|
EGHDK |
Wait. No it doesn't have android:process attribute
|
Mark M. |
OK
|
EGHDK |
I meant "yeah" to your security concern
|
Mark M. |
when you say "I'm working on someone elses sample repo", is this app widget in a separate app from the ContentProvider itself?
|
EGHDK |
Nope.
|
EGHDK |
Same application and all. Just the project was someone elses. They implemented the content provider and the activity.
|
EGHDK |
I'm trying to do the widget.
|
Mark M. |
so you're sure that barqsoft.footballscores.ScoresProvider is in the same app as barqsoft.footballscores.WidgetRemoteViewsFactory?
|
Mark M. |
and that there isn't another rogue barqsoft.footballscores.ScoresProvider floating around this device or emulator?
|
EGHDK |
Yeah. Let me post my manifest really quick. This isn't a huge deal, but I'm just curious at this point.
|
EGHDK | |
EGHDK |
Let me delete all instances off the emulator
|
Sep 22 | 4:30 PM |
Mark M. |
yeah, I cannot explain what you're seeing, sorry
|
EGHDK |
Yeah, so if the manifest gives you any hints then cool. If not, no problem.
|
EGHDK |
Okay. It's not going into production. Just has to work as a POC for now.
|
EGHDK |
I was more interested in seeing if Widgets explicitly need a content provider or if they can just query my db or something.
|
Mark M. |
no, they can work straight with your database
|
EGHDK |
Okay cool. question 2! If something shouldn't be null... should I put a null check around it anyway? Like example today, I'm writing an adapter and I did if (myList.getItem(i) !=null) {//do something} but it's like... should that just stay there without the check? Because in my adapter getview, I should never get something that doesn't exist. Not sure if I made any sense.
|
Mark M. |
if you are sure that it will not be null, and your test suite will catch it if you are incorrect, you could skip the null check
|
Sep 22 | 4:35 PM |
EGHDK |
Yeah, I guess whats best practice if you have something that should "never" be null. Put a null check or not?
|
EGHDK |
I guess its personal preference?
|
Mark M. |
more or less, where "personal preference" may be supplanted by a team's coding conventions in an organization
|
Sep 22 | 4:40 PM |
EGHDK |
cool. okay
|
EGHDK |
Okay, this next one is doze related. In doze apparently the system doesn't care about wakelocks... correct?
|
Mark M. |
correct
|
EGHDK |
So will GCM work? "As of M Preview 3 release, Google Cloud Messaging (GCM) lets you designate high-priority messages. If your app receives a high-priority GCM message, the system grants brief network access even when the device is dozing."
|
Mark M. |
Google effectively "whitelisted" themselves
|
Mark M. |
so the GCM part of Play Services will work
|
EGHDK |
gotcha.
|
Mark M. |
and it will wake you up to be able to do a pinch of work
|
Mark M. |
however, how long you have is anyone's guess
|
EGHDK |
can I start a service with wakelock though?
|
EGHDK |
I guess not?
|
Mark M. |
I don't really understand the question, sorry
|
Sep 22 | 4:45 PM |
EGHDK |
Well I can do a pinch of work in the receiver... but in the receiver can I start a service with wakelock and keep that service going? Even though Doze was supposed to not allow wakelocks?
|
Mark M. |
well, you can try
|
Mark M. |
it won't do you much good
|
Mark M. |
while I haven't tested GCM specifically, I have no evidence that grabbing a wakelock when you get control in Doze mode (e.g., during "idle maintenance periods") has any effect
|
Mark M. |
when Doze mode starts up again, your wakelocks are moot
|
Mark M. |
so, it's critical that your response to an incoming GCM message is very quick
|
EGHDK |
Okay. Good enough for me. Just curious. Next question has to do with rotation... or... errr locking rotation.
|
EGHDK |
Hangouts doesn't support rotation when you are in the Inbox screen. It's locked to portrait on my phone, but on my nexus 9, it's locked to landscape. How'd they do that? The app doesn't actually rotate. just different devices are locked differently. If I make my app lock to portrait, on my phone its portrait, and on my nexus 9 its portrait, which I don't want. I want it to be landscape if possible.
|
Mark M. |
well, one possibility is if android:screenOrientation supports a resource value, like an int resource
|
Mark M. |
in that case, they could be supplying different values in different resource sets (e.g., res/values/ and res/values-sw720dp/)
|
Sep 22 | 4:50 PM |
Mark M. |
there are also ways of requesting orientation lock in Java
|
EGHDK |
I could have sworn I read of a value in the manifest you can set thats like "devicePreferedOritation"
|
EGHDK |
But I havne't been able to find anything about it when I searched.
|
Mark M. |
that rings a bell, but the ring is very light, far off in the distance
|
EGHDK |
Yeah. as it was for me too. Maybe I'll search again.
|
Mark M. |
besides, the Nexus 9's default preferred orientation is probably portrait
|
Mark M. |
large 4:3 tablets are usually thought of as portrait-first
|
Mark M. |
whereas large 16:9 or 16:10 tablets are usually thought of as landscape-first
|
EGHDK |
How do I create an android library project in AS? Do I have to create an empty application first? and then go in and do New > Module > Android Library?
|
EGHDK |
I just want to have an android library project.
|
Mark M. |
if you want to do things purely through the IDE, yes
|
Mark M. |
since I detest the AS new-project wizard, I set up the initial files outside of the IDE first, then import the project
|
Sep 22 | 4:55 PM |
EGHDK |
Okay thats enough for me today.
|
Mark M. |
OK
|
Mark M. |
next one is tomorrow, 9am US Eastern
|
Sep 22 | 5:00 PM |
Mark M. |
that's a wrap for the chat -- the transcript will be posted to https://commonsware.com/office-hours/ shortly, per usual
|
Mark M. |
have a pleasant day!
|
EGHDK | has left the room |
Mark M. | turned off guest access |