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.
Related
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".
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.
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
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.
I need to make an app for an android 2.3.6. Which SDK Should I use? SDK Manager only shows 2.3.3 API 10 as the highest one.
The Android API level list says that the highest API level you can use for 2.3.6 is API level 10. The next higher level 11 requires at least Android 3.0.
use 2.3.6 API 10 which full fills your requirement
If you use 2.2 or 2.1 it also help you to make it compatible for lower versions