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!
|
Mark M. |
how can I help you today?
|
Susheel C. |
I have an android app I need to build. Please let me explain the functionality .
|
Susheel C. |
A user will have to sign up for an account in the app's home page
|
Susheel C. |
and then enter another user's phone number...
|
Susheel C. |
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
|
Susheel C. |
by either hitting a pre-defined option or with a custom message
|
Susheel C. |
simple enough
|
Susheel C. |
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
|
May 8 | 7:30 PM |
Susheel C. |
ok
|
Susheel C. |
what is the best way to implement authentication? Oauth2?
|
Mark M. |
um, I can't really answer that
|
Susheel C. |
ok
|
Susheel C. |
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
|
Mark M. |
your first step is to hire an attorney and ask your attorney about the legal issues involved with collecting and distributing phone numbers
|
May 8 | 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
|
Mark M. |
but that needs to be the foundation of the decision as to where you store personally-identifying information
|
Mark M. |
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
|
May 8 | 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
|
Mark M. |
one is to copy the information you need from the contact info (e.g., phone number)
|
Mark M. |
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
|
Mark M. |
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
|
May 8 | 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.
|
Susheel C. |
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
|
Mark M. |
if you want to send an SMS, you need to send an SMS
|
Mark M. |
SmsManager can do that
|
May 8 | 7:55 PM |
Susheel C. |
ok
|
Susheel C. |
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
|
Susheel C. |
oh
|
Susheel C. |
is it possible to 'listen' to an 'sms sending failure' event?
|
Susheel C. |
with knowing possible reasons?
|
Mark M. |
well, you can specify a PendingIntent that will be invoked when the message is sent or failed
|
Mark M. |
see sendTextMessage() on SmsManager for details
|
Susheel C. |
ok
|
May 8 | 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?
|
Susheel C. |
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
|
May 8 | 8:05 PM |
Susheel C. |
Is it possible to draw a 'custom route' on an android map?
|
May 8 | 8:10 PM |
Mark M. |
given enough points, you can draw any Polyline you wish
|
Susheel C. |
ok
|
Susheel C. |
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
|
May 8 | 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.
|
Susheel C. |
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
|
Mark M. |
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
|
May 8 | 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 |
May 8 | 8:30 PM |
Mark M. | turned off guest access |