3

I want to make my App backward compatbible to API level 8 (Android 2.2).

My problem is, that Android Beam requires API level 14 (Android 4.0).

Is it possible to implements this function without creating two apks?

public class Beam extends Activity implements CreateNdefMessageCallback,OnNdefPushCompleteCallback {
    ...
}

1 Answers1

0

As long as the code that uses this function is not run on a device that does not support it, you will not have an issue.

Just check the current SDK level and hide the function from the user if the device does not support it.

Kuffs
  • 35,581
  • 10
  • 79
  • 92
  • But the problem is, that I have to implement CreateNdefMessageCallback and OnNdefPushCompleteCallback. – user2876119 Oct 13 '13 at 15:18
  • Ensure that you compile with an SDK that understands the functions you want to use.http://stackoverflow.com/questions/4568267/android-min-sdk-version-vs-target-sdk-version – Kuffs Oct 13 '13 at 15:20
  • Either use different activities for each SDK level or do not implement the interface. Just set the callbacks manually. – Kuffs Oct 13 '13 at 15:25
  • And how can I do this? – user2876119 Oct 13 '13 at 15:27
  • 1
    See the answer here for how to manually set a callback function. http://stackoverflow.com/questions/19346201/cant-register-more-than-one-sensor-in-android-service/19346303#19346303 different methods but same basic idea. – Kuffs Oct 13 '13 at 15:27