One APK to rule them all

714 views
653 views

Published on

How to use the Android Framework to target many different devices

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
714
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

One APK to rule them all

  1. 1. Dominik Helleberg | inovex GmbH One APK to rule them all
  2. 2. Dominik Helleberg Mobile Development Android HTML5 http://dominik-helleberg.de/+ http://twitter.com/_cirrus_
  3. 3. Der Android Zoo
  4. 4. Besser?
  5. 5. TheFWord
  6. 6. Der Android Zoo Challenging, butAndroid is designed to handle that!
  7. 7. Getting started... Screens ResolutionScreensize Density
  8. 8. Screensize2‘‘ 4‘‘ 7‘‘ 10‘‘small normal large xlarge
  9. 9. Resolution 1280x800 1280x720320 x 240
  10. 10. Density120 160 200 300ldpi mdpi hdpi xhdpi
  11. 11. ??? ResolutionScreensize Density
  12. 12. DP & SP120 160 200 300ldpi mdpi hdpi xhdpi
  13. 13. PX vs. DP & SP
  14. 14. PX vs. DP & SP
  15. 15. Layout ManagerPortions of this page are reproduced from work created and shared by the Android Open Source Project and used according toterms described in the Creative Commons 2.5 Attribution License.
  16. 16. PX vs. DP & SP
  17. 17. PX vs. DP & SP
  18. 18. Spezialisierte Layoutslayout/  layout-­‐land/  layout-­‐hdpi/  layout-­‐large-­‐land/  layout-­‐sw600dp/  
  19. 19. PX vs. DP & SP
  20. 20. Spezialisierte LayoutsPortions of this page are reproduced from work created and shared by the Android Open Source Project and used according toterms described in the Creative Commons 2.5 Attribution License.
  21. 21. Ab wann ist man Tablet?layout-­‐v11/  layout-­‐land/  layout-­‐xlarge/  layout-­‐sw600dp/  layout-­‐sw720dp/    
  22. 22. Activity vs. Fragment ControlPortions of this page are reproduced from work created and shared by the Android Open Source Project and used according toterms described in the Creative Commons 2.5 Attribution License.
  23. 23. Activity vs. Fragment Control Tab ActionBar click Fragment Fragment Activity
  24. 24. Activity vs. Fragment Control Tab ActionBar click Fragment Fragment Activity
  25. 25. Android À la cartePortions of this page are reproduced from work created and shared by the Android Open Source Project and used according toterms described in the Creative Commons 2.5 Attribution License.
  26. 26. Android À la carte - APIsIntent  i  =  null;  if(android.os.Build.VERSION.SDK_INT  >=        android.os.Build.VERSION_CODES.JELLY_BEAN)  {    i  =  new  Intent(this,  JellyBeanActivity.class);  }  else    i  =  new  Intent(this,  DefaultActivity.class);  
  27. 27. Android À la carte - APIs LocationUpdateRequester   LegacyUpdateRequester   FroyoUpdateRequester   GingerBread   UpdateRequester  http://code.google.com/p/android-protips-location/
  28. 28. Android À la carte - APIs CompatLib   CustomImpl   Wrapper  
  29. 29. Android À la carte - Ressourcenvalues/bools.xml  <resources> <bool name="ICS">false</bool> <bool name="preICS">true</bool> </resources>    values-­‐v14/bools.xml  <resources> <bool name="ICS">true</bool> <bool name="preICS">false</bool> </resources>    
  30. 30. Android À la carte - Ressourcen <service android:name=".ICSService" android:enabled="@bool/ICS"> </service>    
  31. 31. Android À la carte - Ressourcen Layout   Layout-­‐v14   Header   Header   Content   Content  
  32. 32. Android À la carte - Ressourcen Layout   Layout-­‐v14       <include/>   Header   <include/>     Content   Content  
  33. 33. Android À la carte - Ressourcen
  34. 34. Android À la carte - Ressourcen
  35. 35. Get it right - lint
  36. 36. Get it right - lint
  37. 37. Get it right - CI
  38. 38. Get it right – Real Devices
  39. 39. Fallbacks / Workarounds<uses-sdk android:minSdkVersion="8" android:targetSdkVersion=“16" /> <supports-screens .../> <compatible-screens ></compatible-screens> <uses-feature android:name="android.hardware.nfc" android:required="true"/>
  40. 40. Fallbacks / WorkaroundsTarget   Max   Sdk   Sdk   10 11-13 16
  41. 41. Fallbacks / Workarounds Target   Max   Sdk   Sdk  10 11-13 16
  42. 42. Fallbacks / Workarounds <supports-screens android:xlargeScreens="false" />
  43. 43. Fallbacks / Workarounds
  44. 44. Fallbacks / Workarounds <manifest ... > <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" android:requiresSmallestWidthDp="600" /> ... <application ... > ... </application> </manifest> Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according toterms described in the Creative Commons 2.5 Attribution License.
  45. 45. Fallbacks / Workarounds <manifest ... > <compatible-screens> <!-- all small size screens --> <screen android:screenSize="small" android:screenDensity="ldpi" /> <screen android:screenSize="small" android:screenDensity="mdpi" /> <screen android:screenSize="small" android:screenDensity="hdpi" /> <screen android:screenSize="small" android:screenDensity="xhdpi" /> <!-- all normal size screens --> <screen android:screenSize="normal" android:screenDensity="ldpi" /> <screen android:screenSize="normal" android:screenDensity="mdpi" /> <screen android:screenSize="normal" android:screenDensity="hdpi" /> <screen android:screenSize="normal" android:screenDensity="xhdpi" /> </compatible-screens> ... <application ... > ... <application> </manifest> Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according toterms described in the Creative Commons 2.5 Attribution License.
  46. 46. DANKE!

×