p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android 4 Application Development (http://p2p.wrox.com/forumdisplay.php?f=685)
-   -   Earthquake Min and targetSDK versions (http://p2p.wrox.com/showthread.php?t=90374)

marfl99 June 19th, 2013 07:20 PM

Earthquake Min and targetSDK versions
 
What is the minSDKVersion and the targetSDKVersion I'm suppose to use on the Earthquake project?

Android23Geek July 21st, 2013 04:17 AM

The project.properties file in the project targets android level 15 thus Ice Cream Sandwich. Although I do not recommend using that one as the platform will throw a NetworkOnMainThreadException.
This webpage link: NetworkOnMainThreadException in Android will take you to a developer.android webpage where Google exhausts why that is or why Android is programmed to react in that specific manner.

EDIT:
If you do not have any experience with AsyncTask or didn't read Chapter 9, I'd advise to not declare a minSDKVersion or targetSDKVersion in AndroidManifest.xml which - if you read the Android documentation on <uses-sdk> - is equivalent to minSDKVersion="1". However, that is a bad development paradigm as network requests usually make the UI/ main thread unresponsive.

marfl99 July 21st, 2013 06:45 PM

Thank you
 
Thank you for the help. I will go over the chapter 9 and proceed.

Android23Geek July 22nd, 2013 03:09 AM

Let me follow up on my post, I wanted to elaborate on your question since I didn't feel like I answered the question. I have changed some settings in the Chapter 6 full-worked out project sample. The changes I made were for experimentation and the rest were instructions from the project in Chapter 6. The book instructs you to use the android.os.Handler class and Threads in the sample project and like I previously wrote, Chapter 9 explains how a developer should/ must work in the 'background'.

Before you define the <uses-sdk> attribute, you need to take into account, the classes you are going to use and the classes already present in your code. In this sample, Reto Meier used ListFragments which were introduced in android api level 11 thus minSDKVersion cannot be lower than 11. Well that is unless your app is backwards-compatible with pre-Android 3.0 devices, but that's not the point. The book and in general, Google suggest to target the latest android version as it contains updates for bug and important additions in comparison to older versions.

So I added the following in the androidmanifest.xml file:
Quote:

<uses-sdk android:minSdkVersion="10"
android:targetSdkVersion="17"/>
I have development experience with code execution in different Threads, so it was not difficult for me to comprehend the documentation of those two classes on developer.android.com. However, remember that NetworkOnMainThreadException was also introduced in android api level 11 thus you're obligated into running network requests on a background thread if you're to explicitly define <uses-sdk> permissions. You can follow the instructions of the book without knowledge of Threads or you could stop reading Chapter 6 and read revelant paragraphs in Chapter 9. Also, there is a button with a thumbs up icon, it's a 'thank you' button... xD

marfl99 July 25th, 2013 08:13 PM

Great ! Thank you for all the help.
 
Fantastic I really appreciate all your help. I will read the chapters to better understand how it works on chapter 9, and go back to finish this example.

Thanks once again.
Marcelo


All times are GMT -4. The time now is 08:28 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.