0

I am developing a app containing EditTexts and I want to support API 21 (Android L).

But my app contains EditTexts and since API 20 (4.4 Android KitKat Wear) doesn't support EditTexts, how to add an exception to API 20 and prevent Android Wear users from downloading it from Play Store while still supporting API 21?

Krupa Patel
  • 3,309
  • 3
  • 23
  • 28
Confuse
  • 5,646
  • 7
  • 36
  • 58
  • `EditText` is definitely available on API Level 20. They may not be available on Wear devices, but that is not tied to the API level. – CommonsWare Aug 25 '14 at 11:23
  • 1
    @CommonsWare is right, and even if it weren't you can specify which devices are able to run your app in your manifest and/or in the developer console. Just throwing an exception when an unsuspecting user is running your app for the first time is pretty bad and can only leave one kind of impression: a bad one. – Xaver Kapeller Aug 25 '14 at 11:24
  • EditText is not available in API 20. – Confuse Aug 25 '14 at 11:25
  • What makes you think that it isn't? And please explain to me this: Why would a class that has been in the Android framework from day one just suddenly be removed in API level 20? You are wrong. – Xaver Kapeller Aug 25 '14 at 11:30
  • API level 20 is for Android Wear devices not for normal android phones. Check this http://stackoverflow.com/questions/24592647/error-in-adding-an-edit-text-in-eclipse – Confuse Aug 25 '14 at 11:33
  • Yes, smart watches don't support `EditTexts`, they are not designed for text input, but that has nothing to do with the phone itself, you can still have an `EditText` there. Are you asking about an android wear device or a phone? – Xaver Kapeller Aug 25 '14 at 11:37
  • To support API 21, I need to support API 20. I just don't want to support API 20. – Confuse Aug 25 '14 at 11:39
  • I have no idea what you mean. You can't and there is no reason to do that anyway. See the answer of @CommonsWare. – Xaver Kapeller Aug 25 '14 at 11:40

1 Answers1

4

But my app contains EditTexts and since API 20 (4.4 Android KitKat Wear) doesn't support EditTexts,

First, API Level 20 supports EditText. You can tell this by actually trying it. For example, I just took this sample project, and not only does it compile fine with a build target of API Level 20, but it runs fine on an API Level 20 emulator. Issues, if any, are with the hardware, not the API level.

Second, Android Wear users cannot download apps on their Wear devices. They download apps for their phone, and those phone apps have a Wear app inside of them (as a raw resource) that is then loaded onto the Wear device. So long as you do not create a Wear app that uses an EditText, and then package that Wear app inside of another app for distribution, you are safe.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • @MarkRenouf: "Wear devices have no keyboard support" -- I would imagine that is up to the manufacturer. Moreover, that does not change the fact that `EditText` is supported on API Level 20. Do not confuse a device (Wear) with an API level. For example, Google TV devices did not support the NDK; this did not mean that Android 3.1 did not support the NDK. – CommonsWare Aug 25 '14 at 14:55
  • I understand -- And I wasn't clear about what he was asking. I thought he was claiming that Wear will support EditText in "L", which makes no sense. But in fact your answer was correct -- he didn't understand that a wear app was packaged distinctly different from a regular app, and not just directly installed from Play. – Mark Renouf Aug 25 '14 at 15:04