Mar 27 | 3:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Mar 27 | 4:00 PM |
Scott | has entered the room |
Mark M. |
howdy, Scott!
|
Mark M. |
how can I help you today?
|
Scott |
hi
|
Scott |
you can make more mistakes so i can extend - joking
|
Mark M. |
?
|
Nitin S. | has entered the room |
Mark M. |
howdy, Nitin!
|
Mark M. |
Scott: do you have a question?
|
Scott |
do you have any idea how to prevent a user from stopping or deleting an app/service?
|
Mark M. |
that's not possible
|
Mark M. |
users can Force Stop anything they want
|
Mark M. |
and the only apps that cannot be deleted are those that are preinstalled
|
Nitin S. |
Hi Mark !
|
Scott |
could i send email if service is stopped ?
|
Mark M. |
if the user presses Force Stop, your whole process goes "poof", and you will not be able to send an email, etc.
|
Mark M. |
Nitin: do you have a question?
|
Mar 27 | 4:05 PM |
Nitin S. |
yes
|
Nitin S. |
I wanted to know the "authTokenType" for one of
the accounts listed in the Accounts & sync settings. Is that
possible? If yes, how?
|
Mark M. |
sorry -- I have no idea
|
Mark M. |
I have not yet worked with the AccountAuthenticator and related classes
|
Nitin S. |
Ohh.. you have any idea how to get X-Auth-Token from an https server?
|
Mark M. |
how are you accessing the server? HttpClient? HttpUrlConnection? WebView? other?
|
Nitin S. |
since its a secure server, i should be using HttpsUrlConnection right?
|
Mark M. |
I meant more in terms of the general API
|
Scott |
i have app that puts device in airplane mode if speed >= 12mph - uses:
|
Mark M. |
any of those could use HTTPS
|
Mark M. |
Nitin: so, is your code using HttpUrlConnection/HttpsUrlConnection?
|
Mar 27 | 4:10 PM |
Mark M. |
or something else?
|
Nitin S. |
i have a set of URLs and to access them, i should be stuffing my header with the X-Auth-Token obtained from the login page..
|
Nitin S. |
Https*
|
Nitin S. |
its using Https*
|
Nitin S. |
i mean i don't have a code now. I want to know how
should I go about getting that token? It might be a lamest question as
this is the 1st time I am working on a web app..
|
Mark M. |
Step #1: Decide what Java classes you will be using to process "the login page"
|
Nitin S. |
X-Auth Token can be obtained if the user enters username and password in the login page..
|
Mark M. |
Step #2: Find in those Java classes how to retrieve a header from your response
|
Nitin S. |
ok..
|
Mark M. |
with HttpUrlConnection, that would be getHeaderField()
|
Mark M. |
Scott: do you have another question?
|
Scott |
yes, sorry i interrupted Nitin
|
Nitin S. |
No probs. :)
|
Scott |
how to tame LocationManager battery use
|
Scott |
View paste
|
Mar 27 | 4:15 PM |
Scott |
the above works great,but really sucks battery
|
Scott |
so, i'm trying to use your "wakeful" to wake up and get just a single fix from LocationManager
|
Mark M. |
you'd want the LocationPoller for that
|
Mark M. |
it's a separate project
|
Scott |
ah !! glad i asked
|
Mark M. | |
Mark M. |
IntentService is not good with listeners
|
Mark M. |
because it wants to shut down once onHandleIntent() ends
|
Mark M. |
LocationPoller is wakeful, but not an IntentService
|
Mark M. |
it's designed for use with AlarmManager for finding your location sporadically
|
Scott |
i'm looking for speed, actually
|
Mark M. |
if your location provider supports it, no problem
|
Scott |
when i used battery sucking code i got good speeds from gps
|
Mark M. |
let's swing back to Nitin
|
Scott |
ok,thanks
|
Mark M. |
Scott: GPS should handle speed reasonably well
|
Mark M. |
Nitin: do you have another question?
|
Mar 27 | 4:20 PM |
Mark M. |
ok, Scott, back to you...
|
Nitin S. |
I was wondering which of the two way i should be
using to get the Token. 1. Using AccountManager 2. Using the Login
Activity and then using HttpPost?
|
Mark M. |
Nitin: I have no idea
|
Mark M. |
again, I have not used AccountManager
|
Nitin S. |
Okay.
|
Nitin S. |
Could you please let me know how to use HttpPost with the HttpsUrlConnection?
|
Mark M. |
HttpPost has nothing to do with HttpsUrlConnection
|
Mark M. |
they are completely separate APIs
|
Mark M. |
HttpPost is for use with HttpClient
|
Mark M. |
you can read about HttpClient in _The Busy Coder's Guide to Android Development_, in the chapter on Internet access
|
Mark M. |
HttpUrlConnection/HttpsUrlConnection have been a
part of standard Java for over a decade, and are covered in many online
resources
|
Nitin S. |
Sure. I should read that. Thank you.
|
Mar 27 | 4:25 PM |
Mark M. |
if either of you have questions, chime in
|
Scott |
no, the location poller may be what i am trying to
do - i do have it working using your "wakeful" pattern,but i don't get
good speedseven though loc.hasSpeed() istrue
|
Mark M. |
are you testing using hardware?
|
Mark M. |
or the emulator?
|
Scott |
motorola bravo phone
|
Mark M. |
so you are getting a Location with lat/lon but no speed, from GPS_PROVIDER?
|
Scott |
yes
|
Mark M. |
that's odd
|
Mark M. |
LocationPoller is unlikely to change that behavior
|
Mar 27 | 4:30 PM |
Mark M. |
it's conceivable that you won't get speed until the second or subsequent fixes, I suppose
|
Mark M. |
I have never looked at speed values in Location
|
Scott |
i am calculating my own speed from 2 positions - kinda works
|
Scott |
i also tried letting it wake up and getting multiple fixes - speed always 0 even though .hasSpeed() returnstrue....
|
Mark M. |
you might consider posting a question to the MOTODEV support boards, in the off chance this is something Bravo-specific
|
Scott |
gives me perfect speed when i don't use alarm to launch LocationManager every fewminutes
|
Nitin S. |
i hv a question.
|
Mark M. |
Nitin: go ahead
|
Nitin S. |
Can you give me a brief overview as to how google
calendar syncs with the calendar app in the user's device? What APIs I
can use for syncing my web calendar with the calendar app?
|
Mark M. |
Scott: my best guess is that GPS needs to process 2+ fixes to start reporting speed, but that is just a guess
|
Mark M. |
Nitin: On Android 4.0+, there is CalendarContract
|
Mark M. |
I have a short chapter on that in _The Busy Coder's Guide to Advanced Android Development_
|
Mark M. |
there is no documented/supported API for the Calendar app before Android 4.0
|
Mar 27 | 4:35 PM |
Nitin S. |
so it it that I can do the syncs in Gingerbread, Froyo?
|
Nitin S. |
i would study that.
|
Nitin S. |
I cant*
|
Mark M. |
the app certainly syncs going back to earlier than 4.0
|
Mark M. |
whether or not any of the sync APIs in Android let you manipulate that behavior, I cannot say
|
Mark M. |
if either of you have any questions, chime in
|
Mar 27 | 4:40 PM |
Nitin S. |
I want my app to do the syncing even in Gingerbread. How is that possible?
|
Mark M. |
I have no experience with AccountAuthenticator, AccountManager, or any of the syncing APIs
|
Nitin S. |
Okay.
|
Nitin S. |
Thank you. I am done for the day. Have a nice day. :)
|
Mark M. |
you too!
|
Nitin S. | has left the room |
Mar 27 | 4:45 PM |
Scott |
i have to go drive somewhere to test my app so thanks for your help - and appreciate the sample codeverymuch
|
Mark M. |
no problem! drive safely! :-)
|
Scott | has left the room |
Mar 27 | 5:00 PM |
Mark M. | turned off guest access |