Google Glass sensors and API levels - android

The following paragraph is a note found in the GDK references for Google Glass.
But I'm not sure exactly what it means. Can anyone explain to me what this paragraph
is trying explain?
Note: The Glass platform is based on Android 4.4 (API Level 19), but does not support the sensor features of that platform level or Android 4.3 (API Level 18). API features for sensors is frozen at Android 4.2 (API Level 17) for the aforementioned sensors that are supported.

Glass plateform is 4.4 uses API 19 you can use all android features but in case you want to use sensors you need to see API lvl 17 reference to know what you can and can't use
so you cant use
TYPE_SIGNIFICANT_MOTION
TYPE_STEP_COUNTER
TYPE_STEP_DETECTOR
getFifoMaxEventCount()
getFifoReservedEventCount()
...
visit Android developper reference for more details

Related

Is MediaStore.MediaColumns#DATE_TAKEN only available from API level 29?

I am trying to use MediaStore.Images.Media.DATE_TAKEN and getting warning from Android Studio IDE that it requires API 29 (Android Q). The official Google documentation here says this was Added in API level 29. Is this really true?
I've checked the Google Sources from past releases all the way back until API 19 (KitKat) and I saw MediaStore.MediaColumns#DATE_TAKEN field being available since then. Why is the official documentation saying something different?
Android 4.4 (KitKat) MediaStore
Android 5.0 (Lollipop) MediaStore
Android 6.0 (Marshmallow) MediaStore
Android 7.0 (Nougat) MediaStore
Android 8.0 (Oreo) MediaStore
Android 9.0 (Pie) MediaStore
Can someone please clarify the truth? Can I reliably use MediaStore.Images.Media.DATE_TAKEN from API 19+? Thanks!
Thanks to this answer.
From the Api diff for level 29, we can see that DATE_TAKEN has always been there, even if the api level is below 29. The only difference is that before Android Q this const was in MediaStore.Images.ImageColumns but was moved to MediaStore.MediaColumns by now. Meanwhile ImageColumns extends MediaColumns. So the lint cannot identify them accurately.
However, the value itself does not change before and after the move. So you can just ignore the warning.

How to make Android Apps designed for API 22 compatible with API21

I am new to android development and using Xamarin.Android so please keeps terminology simple and relevant if possible.
Current question is, are apps developed for API 22 (android 5.1) compatible with API 21 (android 5.0) by nature - i.e. without adding any package and stuff. If not, how do I make backwards compatibility possible? Thanks.
Typically, you set a minimum SDK value, and a target SDK, and that says what API "range" your app runs against. You additionally compile with a particular SDK version, and that includes the code and resources for the app.
Most of the core API methods and classes are available starting at API 1.
If you want to include libraries, the support libraries should get you backwards compatible back to about API 7.
are apps developed for API 22 (android 5.1) compatible with API 21
If you use classes and methods which were introduced in API 22, then your app will not run on API 21. On the other hand, if you limit yourself to only methods available on API 21, then your app will run on both API 21 and API 22. For newer features, you can use the Support Library.

Which targetSDK to use for BLE?

I’m building an Android app which should run on every device with Bluetooth Low Energy, which means a minSDK of 18. I’m not sure as to which targetSDK I should use however. I read online that it is good practice to always use the latest version for this (API 22). Is this the case, or should I build my application with every targetSDK that I support, i.e. build with the SDK 18 for applications that run API 18, build with SDK 19 for devices with API 19, …?
I’m confused since to start a BLE discovery I can use either startScan() or startLeScan(). The Android documentation tells me: "startLeScan() was deprecated in API level 21, use startScan() instead". I’m unsure what impact this has on which targetSDK I should use to compile my app with. Will devices running API 18 will be able to run my app if I compile with SDK 22 and use startScan(), and will devices running API 22 be able to run my app if I compile with API 18 and use startLeScan()? Or should I really just build my application with every targetSDK that I support like mentioned above?
Let me answer this for you.
1) you already know minSDK should be 18(cool). Because LE supports is there on or after that.
2) If you build your app using target sdk 18, it will work on devices supporting Android 5.0/5.1 also.
3) If you build your app using target >sdk 21, and use startLeScan instead of startScan(startScan is introduced in 5.0/sdk21), it will work on all devices running on >18 api level.
4) Now the tricky part, there are also other apis which are available on 5.0+, which were missing on lower versions. I will suggest build the app using target of the latest sdk (currently 23).
i) Use different apis to achieve same results in different versions. Like if the phone running on lower than Android 5.0, use startLeScan, else startScan.
ii) There are differences on Android 5.0 and 5.1 also, so use those methods accordingly.
5) Some apis like startLeScan are deprecated, but I know, they are still working as they have tied them up with new apis. so until they remove the old apis, they will work on all platforms. This is precisely what deprecation means :)
So answer of your question "Which target sdk should be use", answer is latest sdk :), and call respective apis based on SDK version. You can get SDK version on run time via android.os.Build.VERSION.SDK_INT
I'd recommend to use Android 5.0 and above. Why? This video quite clearly states "BLE in Android below 5.0 is crappy".

How to create AVD targeted to API level 11 for Android

I am creating an application which has minimum SDK setup to API Level 11. I am using API level 11 as target and compile SDK. I want to test if my application will work on API level 11 devices. I tried to get system image for API Level 11 using Android SDK manager but could not find it.
I also tried Genymotion but could not find there also.
How can I get API level 11 system image?
Or is there any other way I can be sure if my application will work on API 11 (Virtual machines)?
Thanks
I would not care about API 11-14. If you checkout the platform versions dashboard you will see that there are no Android 3.X devices out there. Vast majority of 3.x devices have been updated to 4.x. The not updated rest are most likely inactive devices, which are not actively used.
Additionally, when targeting API 11 you target about 0% of Android users with such devices, but you do invest time in supporting it. I would really suggest to reconsider your target API and switch to API 15.

Why android reference does not list "Android 2.3.5–2.3.7" as API 10?

In the android documentation there is nothing about Android 2.3.5, 2.3.6, 2.3.7: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
Wikipedia however lists those as API 10 and other answers say it's API 10. Which is the logical thing since API 11 starts with Android 3.0 and there is no such thing like API 10,5...
So did they simply forget to mention it in the android reference? Or is that some kind of "unofficial Android" ?
Here is the thing, android's latest version kitkat(4.4) is api19.
After some minor update, the current kitakt version stands at 4.4.2, however the api version remains the same at 19.
Similarly, all the minor versions of android will not have a corresponding api verison.

Categories

Resources