How to replace OpenGL EGL14 class in android api level 16 - android

I am working on an android video calling application, which currently supports android kitkat (api level 19) . I need to add support for jelly beans(api level 16).
I have done most of the things. But i am using EGL14 class right now, which is not there in android api level 16, as it was introduced in api level 17.
I want to know how and with what to replace it .

The previously available version is EGL10 from the javax.microedition.khronos.egl package, which has been available since API level 1. The reference page is here: http://developer.android.com/reference/javax/microedition/khronos/egl/EGL10.html.
It is overall fairly similar, even though the Java bindings were implemented somewhat differently. And of course it does not have features from newer versions.
If you want to see examples of how typical calls look for both of them in comparison, you can check out my answer to this question here: http://developer.android.com/reference/javax/microedition/khronos/egl/EGL10.html. It contains code to create a context from scratch with both versions.

Related

PreferenceActivity addPreferencesFromResource deprecated

My app so far has been using the appcompat_v7 support library so that I can use fragments for my min target of api 8 and beyond. I just found out that PreferenceFragment requires API 11 and is not apart of the support library.
My question is it safe to use the deprecated addPreferenceFromResource even on API 11 and higher? So that I can maintain my target 8?
As I understand, the question is about using PreferenceActivity.addPreferencesFromResource(). It's perfectly fine to use it if you are targeting API level prior to 11, because on that API levels it is not deprecated.
The only problem that may arise someday is that Google announces that from certain Android version it won't support some older API levels, which (I believe) isn't going to happen in observable future.

Dynamically choose api in mono for android

Is there any way to detect the current version of android and use one code path for one version, and another code path for a later version?
Something like ClipboardManager, there is a new version in API level 11, but the only way of accessing this new class is by telling mono for android that the minimum requirements is API level 11.
I "think" you can get around this using java reflection, but I imagine this wouldn't work when using Mono for Android. Has anyone got any advice on how you can use both ClipboardManager's, the early one on earlier versions, the later one on later versions, without setting the API level as 11 or higher.
This is a generic example, not limited to ClipboardManager. I am sure I will come across more classes that I could optionally use if it is available.
Sure there is. Just make sure to set your target API level in the manifest.
When wanting to use API 11 for instance you could do something like this:
if ((int)Build.VERSION.SdkInt >= 11)
{
//Execute API 11 and up code here
}
However if you are using methods and classes that are only present in API 11, VS might complain that it cannot find them, so you can surround them with a pre-processor symbol like:
#if __ANDROID_11__
// your API 11 and up code here
#endif

can I use API level 11 on android 2.2?

Maybe stupid question but I am developing for android 2.2 to 4.1. Can I use this functionality http://developer.android.com/reference/android/preference/PreferenceFragment.html which is available only from API 11?
or must I use old http://developer.android.com/reference/android/preference/PreferenceActivity.html which has some deprecated methods.
Will old API works well on android 4.1?
PreferenceFragment will not work on 2.2 and 2.3 (only API level 11 and above). But above versions can use the older one. So you could just go with the old PreferenceActivity - deprected methods just mean that they should be avoided, but they usually still works.
CommonsWare have before wrote, that to offer the best experience for the user and still support version 2.2, you should implement two PreferenceActivity classes and then decide at runtime which one to invoke. This can be done by checking Build.VERSION.SDK_INT and compare against '11'.
See the accepted answer here for implementation:
PreferenceActivity Android 4.0 and earlier
yes you can use. right click on project --> select properites --> click on android --> select any target ..
any higher version google taget can run in lower version i.e, classes can be imported.. but it may possible to throw the exception if lower version wont support the class ...

Android Version Differences

I would like to know whether android has supports for the older versions. There are 15 different levels for android currently and I wonder about the followings.
Can a project made on level 5 be used on the devices whose level higher than 5?
How can I find the detailed differences between all the levels. For example, android.widget.VideoView starts with which level?
Assume I made a project based on level 8 nowadays and after a while like 2 years, level 20 has been introduced by that time. And I would like to use one of the classes that belongs to the level 20. I guess there is no way for me to use that class without upgrading my project level to the 20. In this case, is it possible that level 20 doesn't accept some of the classes I used with level 8? If yes, what can be the solution? Can I download the jar file of level 20 and reference it in my project manually? If possible, does this mean that I don't have to upgrade my project level to 20 in order to use classes of level 20?
I am going to start a project in a few days. However, I didn't decide the level yet. I got confused the differences of levels.
Yes Until know all Levels are backward compatible and most likley this will continue a while.
http://developer.android.com/reference/packages.html -> Filter by API Level
Yes you have to upgrade. But you can set the compatibility to a level below that. Than you have to take care that none of the Methods of lvl 20 will be executed in lvl <=19. You can do this by determine the current Version while running your App Build.VERSION.SDK_INT gets you the API level.
Hope this helps:
1- Yes A project made on lower levels will work on higher levels.
2- In the page of the component. For example for android video view you can check in the top right corner SINCE: API LEVEL 1
3-You are right, if you want to use level 20 classes your project will have to be upgraded to level 20, but as far as I know there are no compatibility issues for higher versions. You should take note about the deprecated classes though. Avoid using them because they might not be available later.
1 - yes. Android devices support running code from older levels.
2 - look through the Android docs. It even lets you filter by API level.
3 - Higher levels always let you use the lower level classes. It's just not recommended.
To decide what to support, I looked at the current distribution dashboard to see what was really out there and using the market. I went with level 7 for what I was doing, but that's just me. Level 8 would also be a good place to work from.
Also, if you want to access the better parts of the API on supported devices, but still work on older versions of the API, there's advice in the answers to this question.

How to add IBluetoothA2dp.aidl interface to my project?

I'm using android version 2.2 and I cant find android.bluetooth.IBluetoothA2dp in the bluetooth sub-package android.bluetooth.
Do I have to upgrade to a higher version for this file to be available. Or what else should I do so I could be able to implement this interface to use it in my project?
I'm not sure why you need IBluetoothA2dp and not the BluetoothA2dp. But the IBluetoothA2dp interface is a hidden interface (see here). At least up to Android 3.0 (not including).
As for BluetoothA2dp class it was publicly introduced in API Level 11 (Honeycomb, Android 3.0). It was first introduced in Android as earlier as API Level 3 and marked as hidden. Then it was dramatically changed in API Level 5 at still was marked as hidden. And officially released only in API Level 11.
You can use reflection to access that class on earlier platforms, but that's a tricky and not recommended way.

Categories

Resources