Office Hours — Today, May 8

Monday, April 28

Mark M.
has entered the room
May 8
7:25 PM
Mark M.
turned on guest access
Susheel C.
has entered the room
Susheel C.
Hi Mark
Mark M.
hello, Susheel!
how can I help you today?
Susheel C.
I have an android app I need to build. Please let me explain the functionality .
A user will have to sign up for an account in the app's home page
and then enter another user's phone number...
the app will periodically send text messages to the recipient to ask them how they are doing...the recipient will have a chance to respond
by either hitting a pre-defined option or with a custom message
simple enough
please can you give me pointers?
Mark M.
pointers to... what?
Susheel C.
on how I can go about doing this
Mark M.
doing... what?
Susheel C.
So how can I store a user's info after signing up?
Mark M.
use a database, SharedPreferences, or a file
7:30 PM
Susheel C.
ok
what is the best way to implement authentication? Oauth2?
Mark M.
um, I can't really answer that
Susheel C.
ok
Can I store user info on a server? Is it better to do that way?
Mark M.
I cannot tell you if it is "better" because I have no criteria upon which to judge that
your first step is to hire an attorney and ask your attorney about the legal issues involved with collecting and distributing phone numbers
7:35 PM
Mark M.
those issues will vary by jurisdiction, and I am not an attorney, so I cannot advise you on that issue
but that needs to be the foundation of the decision as to where you store personally-identifying information
if you are writing this app on behalf of a business, take the issue to your manager, and have the manager arrange the meeting with the business' legal counsel
Susheel C.
ok
7:45 PM
Susheel C.
What if I ask the user to pick a phone number from their phone contacts or store the recipient's number on their phone? That way I won't be storing any personal info. Is it possible to use shared preferences to store contact info on a phone?
Mark M.
well, you have two ways of going about that
one is to copy the information you need from the contact info (e.g., phone number)
the problem there is that if the contact's phone number changes, you will not know about that until/unless the user adjusts your app
the other is to store a durable Uri pointing to the contact
Susheel C.
ok
Mark M.
that way, you can read in the phone number as needed and pick up updates
Susheel C.
ok
Mark M.
I know that there are techniques for getting such a durable Uri, but I have never done it personally
Susheel C.
Ok
Mark M.
bear in mind that any of that will require the READ_CONTACTS permission
Susheel C.
ok
Mark M.
and not all users are comfortable giving that out to apps that also hold the INTERNET permission
Susheel C.
ok
7:50 PM
Susheel C.
If I get the user to just enter their recipient's number and only store that info on their phone using shared preferences, that wouldn't require the app to get access to all contacts. right?
Mark M.
correct
Susheel C.
If I implement this method then my app won't require the READ_CONTACTS permission anymore obviously?
Mark M.
correct
Susheel C.
Great.
I guess my next question is about how to send this text message to the recipient. Can I just use the SMS API that comes with android or can I use Google Cloud Messaging? Do you know the pros and cons?
Mark M.
GCM has nothing to do with SMS
if you want to send an SMS, you need to send an SMS
SmsManager can do that
7:55 PM
Susheel C.
ok
can you tell me how I can send automated sms's at regular intervals?
Mark M.
use AlarmManager for the "regular intervals" part
Susheel C.
ok
Mark M.
use SmsManager for sending the SMS messages
Susheel C.
great
Mark M.
bear in mind that there are no guarantees here (e.g., user might have the device in airplane mode)
Susheel C.
thanks
oh
is it possible to 'listen' to an 'sms sending failure' event?
with knowing possible reasons?
Mark M.
well, you can specify a PendingIntent that will be invoked when the message is sent or failed
see sendTextMessage() on SmsManager for details
Susheel C.
ok
8:00 PM
Susheel C.
I have another question. When I receive an sms, is it possible to extract specific info from the body of the text given that I know the format?
I have the same question for email
Mark M.
for SMS, you have the possibility of viewing messages, and so it's just a string
Susheel C.
ok
Mark M.
for email, you have no way to view the messages, unless you are implementing your own email client or the user elects to share the text of the email with you
Susheel C.
ok
8:05 PM
Susheel C.
Is it possible to draw a 'custom route' on an android map?
8:10 PM
Mark M.
given enough points, you can draw any Polyline you wish
Susheel C.
ok
Is it possible to dynamically lookup areas of interest(on google or anywhere else) in my app's background, say restaurants or ATM's in a given location and obtain the location of these points? As opposed to hardcoding the geo-location of these places beforehand? I hope I asked the question clearly
Mark M.
that doesn't really have much to do with Android -- you would need to find some Web service that offers this
Susheel C.
ok
8:15 PM
Susheel C.
Alternatively, if I choose to look up places using google maps in a webview can I then obtain the location from the search results by examining the html or js?
Mark M.
conceivably, I suppose
Susheel C.
Great.
Do you know if there are any disadvantages of using Xamarin for android development? Do I have a cap for the number of questions I'm asking or am I good till 8:30?
Mark M.
I'm not a .NET guy, so I cannot comment on Xamarin
so long as nobody else is in the chat room, you're welcome to ask questions until 8:30
Susheel C.
ok.
Mark M.
when there is more than one person here, I alternate between people, to ensure everyone gets a chance
Susheel C.
great
8:20 PM
Susheel C.
Well thanks for all the help today Mark. Your book is really awesome!
Mark M.
thanks! glad you like it!
Susheel C.
has left the room
8:30 PM
Mark M.
turned off guest access

Monday, April 28

 

Office Hours

People in this transcript

  • Mark Murphy
  • Susheel Chanda