Mar 16 | 7:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Mar 16 | 8:00 PM |
Prasanna P. | has entered the room |
Mark M. |
hello!
|
Prasanna P. |
Hi!
|
Prasanna P. |
View paste
|
Mark M. |
addProximityAlert(), most likely
|
Mark M. |
Done right, you do not need to leave any components of your application running
|
NetApex | has entered the room |
Mark M. |
they'll just get woken up when you get near something
|
Mar 16 | 8:05 PM |
Mark M. |
howdy, Sir Net, of the house of Apex!
|
NetApex |
Good evening Mr M
|
Prasanna P. |
What do you mean by done right?
|
Mark M. |
if you want to take advantage of not needing any components running, you need to shut down those components :-)
|
NetApex |
Quick
question for you. (Not sure if it is a quick answer) I have buttons and
ImageButtons and the like. What do I need to do to make it obvious that
those buttons are selected?
|
Svetlin S. | has entered the room |
Mark M. |
NetApex: define "selected"
|
Mark M. |
howdy, Svetlin!
|
Svetlin S. |
Hi to all.
|
NetApex |
Lol, ok now I feel silly. Thank you!
|
Mar 16 | 8:10 PM |
NetApex |
I should probably look up the way to highlight an item in an xml file
|
NetApex |
as in "onSelected"
|
NetApex |
(if there is such a creature)
|
Mark M. |
buttons should already look different when they are selected (i.e., navigated to with the D-pad)
|
Prasanna P. |
OK.
Say I call addProximityAlert() from an activity. Then can i close the
Activity if the user is not using the activity. Then when you come
close to the location will the activity start again?
|
Mark M. |
Prasanna: Android will execute the PendingIntent you supply in addProximityAlert)(
|
Mark M. |
er, make that ()
|
Mark M. |
what that PendingIntent does is up to you
|
Prasanna P. |
OH. OK. Thanks.
|
Prasanna P. |
Another
Question. - I want to have my service call a utility method that
returns the distance when I provide it with two geo coordinates. Do I
need to have this method in the same class as the service? Or can I
create another class that has all of the utility methods and get the
service to call a utility method in this other class?
|
Mark M. |
either way works
|
Mark M. |
all depends on how you define your classes
|
Mark M. |
that's a Java/OO thing, nothing particular to Android
|
NetApex |
When
I do an "ImageButton btn=(ImageButton)findViewById(R.id.musicIcon);" I
can run the D-pad all around the screen to any of the buttons and there
isn't a change. Do I have to give it a background or some sorts to make
a difference?
|
Prasanna P. |
OK. The service is always running in the background. So does this make any difference in this context?
|
Mark M. |
The service darned well better not be "always running in the background"
|
Mark M. | |
Prasanna P. |
OK : )
|
Mar 16 | 8:15 PM |
Mark M. |
that's the point I was trying to bring up with the addProximityAlert()
|
Mark M. |
you don't want to try having everlasting services
|
Mark M. |
addProximityAlert() may mean you do not have to
|
Prasanna P. |
OK. Got it. Thanks!
|
NetApex |
(this is why I love listening in.. gives me so many ideas... that I have no clue how to implement)
|
Svetlin S. |
OK, I see no updates, may I ask something?
|
Mark M. |
go ahead
|
Svetlin S. |
I am trying to call asynchronously a web service, but have a problem.
|
Svetlin S. |
I am using a wrapper of HttpClient, but I think my problem is more generic.
|
Svetlin S. |
Here it is described in much detail.
|
Svetlin S. | |
Mar 16 | 8:20 PM |
Mark M. |
uh, OK
|
Mark M. |
for a small bit of code, this is awfully complicated
|
Mark M. |
first, get rid of theThingHandler
|
Mark M. |
onPostExecute() is invoked on the main application thread, so do your UI updates there
|
Mark M. |
well, actually
|
Mark M. |
I frankly have no idea what's going on in your code
|
Mark M. |
I don't own Unlocking Android, nor have I ever seen HTTPRequestHelper
|
Svetlin S. |
I thought having the handler "forces" the http call to complete?
|
Mark M. |
heck no
|
Mark M. |
the HTTP request has nothing to do with handlers, at least not normally
|
Mark M. | |
Mark M. |
that is how one of my book examples does a background HTTP request-and-parse
|
Mark M. |
it uses AsyncTask, but no HTTPRequestHelper
|
Svetlin S. |
The Helper is just a convenience wrapper to the default HttpClient.
|
Mark M. |
if nothing else, it may give you some ideas of how Unlocking Android's stuff is supposed to work
|
Mark M. |
OK
|
Mark M. |
HttpClient is already pretty convenient, IMHO :-)
|
Svetlin S. |
But, doesn't registering a handler to HttpClient
|
Mark M. |
HttpClient does not know about Handlers
|
Svetlin S. |
make HttpClient call it as soon as it completes the request?
|
Mark M. |
HttpClient is an Apache project, not an Android thing
|
Mar 16 | 8:25 PM |
Mark M. |
hence, HttpClient *can't* know about Handlers
|
Mark M. |
that's something HTTPRequestHelper must be doing
|
Mark M. |
but, if you're using AsyncTask, you don't *also* need a Handler
|
Mark M. |
anything the Handler would do for you, AsyncTask can
|
Svetlin S. |
Yes, you are correct here.
|
Svetlin S. |
Interestingly, if I start the Helper in a thread of it's own -- it works.
|
Svetlin S. |
However, I want to have a background thread for both the HTTPRequestHelper and it's "associated" handler...
|
Svetlin S. |
which I can call on the main UI thread.
|
Svetlin S. |
This simplifies my logic.
|
Mark M. |
I'll take your word for that
|
Svetlin S. |
OK. So your advice would be to study the link you posted, I guess.
|
Mark M. |
well, I'm certainly limited in my ability to help with HTTPRequestHelper
|
Mark M. |
I can help with my examples, and I can help with general Android questions
|
Mark M. |
perhaps the Unlocking Android authors have a forum or other place where you can get assistance for HTTPRequestHelper
|
Prasanna P. |
Can I ask a question?
|
Svetlin S. |
Of course, Mark. I asked here as I value your experience in threading.
|
Mar 16 | 8:30 PM |
Svetlin S. |
Thank you for your feedback, it is appreciated!
|
Mark M. |
Svetlin: sorry I can't be of greater assistance
|
Mark M. |
Prasanna: go ahead
|
Prasanna P. |
What is a method you can use to create a dialog from a service where the user has to click to get rid of?
|
Prasanna P. |
Is this a good idea?
|
Mark M. |
not really
|
Mark M. |
you don't know what the user is doing
|
Mark M. |
if they are playing a game, or in the middle of a text message, they will be...unhappy if you pop up a dialog
|
Mark M. |
that's what Notifications (status bar icons) are for
|
Prasanna P. |
OK. But if i wanted to can I do this?
|
Mark M. |
I don't think so
|
Mark M. |
best you could do is pop up a Dialog-themed Activity
|
Mark M. |
leastways, I have never seen code to pop up a Dialog from a Service
|
Prasanna P. |
OK. Thanks. Need to rethink my approach.
|
Mar 16 | 8:35 PM |
Prasanna P. |
By
the way is the reason for this that until the user gets rid of the
dialog, the service also will be running and this is not a good idea
|
Prasanna P. |
because it is resource intensive?
|
Mark M. |
services take up RAM, possibly CPU if they are doing things
|
Mark M. |
moreover,
services will be killed off eventually, which is why you don't want to
design around an assumption that they live forever
|
Prasanna P. |
Thanks for you help Mark. I am going help out. Buy all.
|
Mark M. |
see you later!
|
Prasanna P. |
sorry i mean I am going to head out.
|
Prasanna P. | has left the room |
Mar 16 | 8:40 PM |
Mark M. |
any other questions?
|
Svetlin S. |
No questions, I have enough to think about now... OK, have a nice one everyone, I am off too!
|
Mark M. |
see you around!
|
Svetlin S. | has left the room |
Mar 16 | 8:45 PM |
Sebastian | has entered the room |
Mark M. |
howdy, Sebastian!
|
Sebastian |
hey there
|
Mark M. |
got any questions?
|
Sebastian |
i have a vague question about the alarmmanager. it seems like i have problems with alarms not firing on a google nexus one
|
Sebastian |
at least so far i have not been able to reproduce it on a different device
|
Sebastian |
isn't
there anything which could cause
alarmManager.set(AlarmManager.RTC_WAKEUP, alarmTime, alarmSender); not
to cause an alarm?
|
Mark M. |
if somebody hit your app with Advanced Task Killer or the like, that wipes out alarms
|
Sebastian |
like wakelock, time changes maybe ? or deep sleep mode of the device?
|
Mark M. |
WakeLocks should not affect alarm firing
|
Mark M. |
not sure what happens if there's a time change right around the alarm's time
|
Mark M. |
I'm not aware that Android has a "deep sleep mode"
|
Mar 16 | 8:50 PM |
Mark M. |
at least as I would define the term
|
Sebastian |
from what i observed usually things work out on time changes/date changes/time zone changes
|
Mark M. |
how long are you going between alarms? or how far in the future are the alarms that you schedule that aren't firing?
|
Sebastian |
so far i have seen the problem in one hour intervalls
|
Mark M. |
In the code fragment you have above, you used set() instead of setRepeating()
|
Mark M. |
Do you mean your code calls set() for one hour in the future, and then it does not get woken up?
|
Sebastian |
related, can i increase the logcat buffer ? often when i get the log it doesn't go far enough back
|
Mark M. |
I'm pretty sure the logcat buffer size is baked in firmware
|
Mark M. |
you might be able to tweak it for the emulator
|
Sebastian |
yes, i call set for one hour in the future. and call it again to "reschedule"
|
Mark M. |
how frequently does it fail? every alarm, one in 10, one in 100?
|
Sebastian |
i
have seen the one hour alarm work and then suddenly stop until the user
opens my app and does something which usually set the alarm again
|
Mar 16 | 8:55 PM |
Mark M. |
and, where are you rescheduling it -- inside the onReceive() call of your BroadcastReceiver, or somewhere else?
|
Mar 16 | 8:55 PM |
Sebastian |
usually (with no user interaction) within the onreceive call
|
Mark M. |
hmmm...ok, so you're not going to be falling asleep before the reschedule...
|
Mark M. |
any reason why you're not using setRepeating()?
|
Sebastian |
the intervall might change. e.g. going from one hour to 15min. or to a time 8 hours from now.
|
Mark M. |
oh
|
Sebastian |
so when onreceive is called we reevaluate when to set the next timer.
|
Mark M. |
well,
if you can create a sample project that demonstrates the problem, I can
look at the code, try it out, see if I see something
|
Mark M. |
and, if it seems like it's a bug in the N1/Android 2.1, we'll need that project anyway to attach to an issue on b.android.com
|
Sebastian |
okay,
that's a good idea. maybe i can also eliminate any complexities. very
possible that this is caused by some complexities in my app
|
Mark M. |
just
remind me that we chatted about this here when you send me the project
(or link to the project), either on the [cw-android] Google Group or
directly
|
Mar 16 | 9:00 PM |
Sebastian |
okay sounds good. thank you
|
Mark M. |
and that's all the time we have for this evening's chat
|
Mark M. |
next one is Thursday morning (US Eastern time)
|
Mark M. |
have a pleasant evening, all!
|
Sebastian |
bye, good night
|
NetApex |
you too
|
NetApex | has left the room |
Sebastian | has left the room |
Mark M. | turned off guest access |