xref: /aosp_15_r20/development/samples/CrossCompatibility/_index.html (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1*90c8c64dSAndroid Build Coastguard Worker<p>This sample demonstrates how to design an application that is compatible across different Android versions. Applications
2*90c8c64dSAndroid Build Coastguard Workershould degrade gracefully on older platform versions, dropping features or providing
3*90c8c64dSAndroid Build Coastguard Workerwhen the platform support needed by features or functionality isn't available.</p>
4*90c8c64dSAndroid Build Coastguard Worker
5*90c8c64dSAndroid Build Coastguard Worker<p>In this case, the CrossCompatibility application shows how to use APIs that are not available in all Android versions and
6*90c8c64dSAndroid Build Coastguard Workerstill create a single <code>.apk</code> that runs on all Android versions.</p>
7*90c8c64dSAndroid Build Coastguard Worker
8*90c8c64dSAndroid Build Coastguard Worker<ul>
9*90c8c64dSAndroid Build Coastguard Worker<li>The main application's <a
10*90c8c64dSAndroid Build Coastguard Workerhref="AndroidManifest.html">AndroidManifest.xml</a> file declares that it is backwards compatible with API level 3 devices with attribute <code>minSdkVersion</code> in the <code>uses-sdk</code> tag.
11*90c8c64dSAndroid Build Coastguard Worker </li>
12*90c8c64dSAndroid Build Coastguard Worker<li>
13*90c8c64dSAndroid Build Coastguard Worker<a
14*90c8c64dSAndroid Build Coastguard Workerhref="src/com/example/android/touchexample/VersionedGestureDetector.html">VersionedGestureDetector.java</a>
15*90c8c64dSAndroid Build Coastguard Workeris a version independent abstract class which factors out multitouch APIs that differ between platform versions. </li>
16*90c8c64dSAndroid Build Coastguard Worker
17*90c8c64dSAndroid Build Coastguard Worker</ul>
18*90c8c64dSAndroid Build Coastguard Worker
19*90c8c64dSAndroid Build Coastguard Worker<p> For more information on how to make your applications cross-compatible, please check out the original
20*90c8c64dSAndroid Build Coastguard Workerblogpost <a href="http://android-developers.blogspot.com/2010/07/how-to-have-your-cupcake-and-eat-it-too.html">here</a>.</p>
21