'''Originally Posted By: mkwan'''
Group: Michael, Gayathri, Sayali, Amruta<br><br>Problem 8 solution:<br>1. Android:Code: &nbsp;Log.i(&quot;TooSmallApp&quot;, &quot;It's cramped in here&quot;);<br>2. iOS: Code: NSLog(@&quot;TooSmallApp: It's cramped in here&quot;);<br><br>Problem 10 Android solution:<br>1. Add the following to AndroidManifest.xml:<br>Code: <br><br>2. Then create this class:<br>Code: public class MailTestActivity extends Activity {<br>&nbsp; &nbsp;private final static String MAIL_COMMAND = &quot;HELO my.mailserver.org&quot;;<br>&nbsp; &nbsp;private final static String DESTINATION_ADDRESS = &quot;my.mailserver.org&quot;;&nbsp; &nbsp;<br>&nbsp; &nbsp;private final static int DESTINATION_PORT = 25;<br>&nbsp; &nbsp; /** Called when the activity is first created. */<br>&nbsp; &nbsp; @Override<br>&nbsp; &nbsp; public void onCreate(Bundle savedInstanceState) {<br>&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate(savedInstanceState);<br>&nbsp; &nbsp; &nbsp; &nbsp; setContentView(R.layout.main);<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; Socket connection = null;<br>&nbsp; &nbsp; &nbsp; &nbsp; DataOutputStream outputStream = null;<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; // This is needed for SDK 9 and above when opening sockets in the main thread.<br>&nbsp; &nbsp; &nbsp; &nbsp; ThreadPolicy tp = ThreadPolicy.LAX;<br>&nbsp; &nbsp; &nbsp; &nbsp; StrictMode.setThreadPolicy(tp);&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; try {<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;connection = new Socket(DESTINATION_ADDRESS, DESTINATION_PORT);<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;outputStream = new DataOutputStream(connection.getOutputStream());<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;outputStream.writeUTF(MAIL_COMMAND);<br>&nbsp; &nbsp;&nbsp; &nbsp;} catch (UnknownHostException e) {<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Log.d(&quot;MailTest&quot;, &quot;Unable to connect to &quot; + DESTINATION_ADDRESS + &quot;:&quot; + DESTINATION_PORT);<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;e.printStackTrace();<br>&nbsp; &nbsp;&nbsp; &nbsp;} catch (IOException e) {<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Log.d(&quot;MailTest&quot;, &quot;Unable to get IO stream&quot;);<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;e.printStackTrace();<br>&nbsp; &nbsp;&nbsp; &nbsp;} finally<br>&nbsp; &nbsp;&nbsp; &nbsp;{&nbsp; &nbsp;&nbsp; &nbsp;<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;try {<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;outputStream.close();<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;connection.close();<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;} catch (IOException e) {<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;e.printStackTrace();<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;}&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>&nbsp; &nbsp;&nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; }<br>}<br>