Office Hours — Today, January 29

Thursday, January 24

Jan 29
9:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
Ron
has entered the room
Ron
Hi Mark
Mark M.
howdy, Ron!
how can I help you today?
Ron
I'm trying to implement socket communications. I can connect to a port on both 3G and wifi, but can only send/receive data on wifi. I have Verizon.
Mark M.
I take it that this is not HTTP/HTTPS?
Marcin
has entered the room
Ron
No, I'm going through port 14444
Mark M.
(BTW, howdy, Marcin -- be with you in a bit!)
it's entirely possible that Verizon is doing some proxying/filtering/whatnot that is interfering
10:00 AM
Mark M.
that's not exactly my area of expertise, though
Marcin
Hi guys
Mark M.
the downside of your scenario is that it is difficult to create a sample app demonstrating the issue, as it relies upon some server somewhere speaking some protocol
I presume that it is the same code that works on WiFi and fails on Verizon -- correct?
Ron
OK, thanks anyway. The iphone app seems to do the job OK. Not sure of the carrier.
Yes, same code, only changed the phone setting.
Mark M.
yeah, that's more likely than not to be tied to the carrier, not something specific to Android or your device
Ron
So a carrier can let connects go through, but not I/O?
Mark M.
well, you might not be connecting to the actual target server
you might be connecting to some proxy that Verizon is running
is it possible for you to temporarily reconfigure the server to use port 80 or some other normally-open port?
if so, try that and see what the behavior is on Verizon
also, I presume that the IP address you are connecting to is on the public Internet -- correct?
Ron
There is an app called TCP port scanner, you input the dns address and port, it tells you whether it is open. I show open for the address, port 14444
10:05 AM
Mark M.
that simply means that the port scanner app thinks it is open
again, it might not be your server, but some Verizon proxy
does the server in question host anything else, such as a Web site?
Ron
No, but it works fine on wi-fi.
Mark M.
again, if the only thing different is that you are talking over Verizon's network, the problem is most likely with Verizon
let me take a question from Marcin, and I will swing back to you in a bit
Marcin: do you have a question?
Marcin
yes
I have a listview with Touch listener
inside onTouch().. switch : ACTION_MOVE
i have this code
View paste
// set color depending on direction
				if (deltaX > 0) {
					mDownView.setBackgroundColor(Color.argb(255, intFactor, 255, intFactor));
				} else {
					mDownView.setBackgroundColor(Color.argb(255, 255, intFactor, intFactor));
				}
				// mDownView.setAlpha(floatFactor);
				mDownView.setTranslationX(deltaX);
the problem is the artefacts like this : http://www.youtube.com/watch?v=kK6s6DKkNC8
10:10 AM
Marcin
what is interesting is that when I uncoment a line code "setAlpha" and set some value 0-1 it works
Mark M.
I cannot speak specifically to your problem
Marcin
if I set a static value of 1.0f it gives same artefacts. Probably due to view reuse
Mark M.
however, there are existing implementations of swipe-to-dismiss
Marcin
I have them working
Mark M.
Marcin
the issue that I am trying to solve is an item gradually changing color
Mark M.
I'd see how they do it, if they do not exhibit the same problem
Marcin
to red when you swipe it left
to green for right
Mark M.
:: shrug ::
again, I do not know what to tell you
my apologies for not being able to help you with this issue
Ron: do you have another question?
Ron
Is there a developer forum or support mechanism specific to Verizon?
Mark M.
not that I am aware of, but I have not gone looking for one, either
10:15 AM
Ron
Then I'm all set for now. Thanks.
Mark M.
OK
Marcin: do you have another question?
OK, well, if either of you come up with a question, chime in
10:20 AM
Marcin
Mark, maybe I will ask this questiona differently so that you can help me
Mark M.
you are welcome to try! :-)
Marcin
I am using Roman Nurik implementation
your first link
Anantha K.
has entered the room
Mark M.
Marcin: OK
Anantha K.
Hi
Marcin
line 277 in SwipeDismissListViewTouchListener.java
Mark M.
(Anantha: hi! I will be with you shortly!)
Marcin
this is where I try to change the background color of swipred item
Mark M.
if (mSwiping)
Marcin
detecting by deltaX
Anantha K.
How to get Phone number of a device?
Mark M.
(Anantha: hi! I will be with you shortly!)
Anantha K.
Sure, thanks!
Marcin
and trying to apply it like that
mDownView.setBackgroundColor(Color.argb(255, intFactor, 255, intFactor));
it works
but only if setAlpha is also called
if i comment out the setAlpha line then it gives artefacts like in video
intFactor - is a value i calculate depending how deep is the swipe (its calculated properly)
10:25 AM
Marcin
Im thinking that setAlpha is somehow refreshing a list item so it shows up properly
Mark M.
what device were you testing this on, and what version of Android is it running?
Marcin
4.0.4
s2 galaxy
Mark M.
you might try disabling hardware acceleration
Marcin
can i do it from code?
Mark M.
ummmm... I think so, but my memory is fuzzy... hold on...
ah, yes
myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
though I am not certain if you can reverse it via code -- the docs are a bit fuzzy on that point: http://developer.android.com/guide/topics/graph...
Marcin
ok will try that
Mark M.
if that helps, that indicates a bug in Android itself, in which case a sample project posted to http://b.android.com might help get it fixed for the future
let me take Anantha's question
Anantha: in general, you cannot get the phone number of the device
Marcin
thanks
Mark M.
the device does not need to know its phone number to work
Anantha K.
oh!
Mark M.
while TelephonyManager has getLine1Number(), the result can be null or an incorrect value
10:30 AM
Mark M.
I know of no reliable means to determine the phone number of the device
Anantha K.
Mark M.
and, of course, not all Android devices are phones
Anantha K.
yes, got it
Mark M.
see the 31-upvoted comment of mine on the accepted answer :-)
Anantha K.
Yes, I saw :)
I have another question
Mark M.
since the others have had a couple of questions already, go ahead
Anantha K.
When should one go for GCM? For e.g) how does Airdroid works? using local server right? can the same be developed using GCM?
I mean without actually running local server on device
Mark M.
Airdroid uses WiFi, as is noted on the Airdroid home page
GCM is not appropriate for this problem set
GCM is not guaranteed, has significant latency, and has only a 4K payload per message
Anantha K.
Can you give me one e.g where GCM is appropriate
Mark M.
Remember the Milk, an online to-do Web app, uses GCM to push changes made via the Web app to your device that is running the Remember the Milk app
10:35 AM
Mark M.
to keep the two environments (online plus on-device/offline) in sync
Gmail uses GCM to tell the on-device app about new mail
etc.
Anantha K.
nice,
Mark M.
Marcin: do you have another question?
Marcin
yes
I have a listview, I would like to add glow effect on the sides - so that it is always there (like blue glow effect on the top)
any ideas how to approach this?
Mark M.
not a clue
Marcin
ok
Mark M.
background image for the ListView, perhaps
Ron: you indicated you didn't have any other questions -- if you come up with one, chime in
Anantha: do you have another question?
10:40 AM
Mark M.
OK, if anyone has any questions, just ask
Marcin
I have a question
Mark M.
first, are you sure that this is tied to setRetainInstance(true)?
somebody was complaining on StackOverflow recently about leaks with Maps V2, and I don't recall setRetainInstance(true) being part of that discussion
Marcin
yes, I have tested multiple times with / without setRetianInsance
it is only leaking like that when it is set to "true"
10:45 AM
Mark M.
the I suspect that the answer is "do not use setRetainInstance(true)"
er, that should have been "then I suspect..."
it's not like we can change, or even look at, the internal implementation of Maps V2
I will try sometime in the next week or so to reproduce your problem
Marcin
ok, just to be clear, there is no official doc from goole saying i shouldnt right?>
Mark M.
I have not seen one
Marcin
ok, thanks
Mark M.
but, the docs have issues
Marcin
yup
Mark M.
for example, you need ACCESS_PHONE_STATE, and that's not documented
sorry, ACCESS_NETWORK_STATE
so, an undocumented limitation with setRetainInstance() would not shock me
Marcin
you should be able to reproduce it with simplest SupportMapFragment
Mark M.
OK
if anyone has any other questions, go ahead and ask
10:50 AM
Marcin
regarding my first question
it works much better
Anantha K.
has left the room
Marcin
if I apply mList.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
its not that smooth though
Mark M.
try it on just the list row
and, yes, it will probably be less smooth
but the point of this experiment is simply to determine if your artifacts are caused by hardware acceleration
if it also happens to give you a production-grade workaround that you prefer over, say, setAlpha(0.9f), that's a bonus
Marcin
on listItem it works worse
but still better than original
Mark M.
"worse" meaning sluggish, or "worse" meaning more artifacts?
Marcin
sorry, artefacts
I tried hack with 0.9/1.0 alpha
10:55 AM
Mark M.
OK, did you get artifacts with disabling hardware acceleration on the whole list?
Marcin
but cant remember the results .. checking..
no artefacts on the listitem.. but listview bg behind swiped item was flickering a bit
where can i find out more info about behaviour on software/hardware accel ?
in context of this specific problem
Mark M.
well, probably nowhere with regards to this specific problem
Marcin
:)
Mark M.
in general, Romain Guy and Chet Haase have done presentations on this
Marcin
google io video?
Mark M.
check the 2012 Google I|O conference videos (and maybe 2011, though some of that would be dated)
with regards to the flickering, that might be an overdraw issue
Marcin
thanks Mark
11:00 AM
Mark M.
and that's a wrap for today's chat
11:00 AM
Mark M.
the transcript will be posted shortly to http://commonsware.com/office-hours/
the next chat is Friday at 4pm Eastern
have a pleasant day, all!
Marcin
bye!
Ron
has left the room
Marcin
has left the room
Mark M.
turned off guest access

Thursday, January 24

 

Office Hours

People in this transcript

  • Anantha Krishnan S R
  • Marcin
  • Mark Murphy
  • Ron