0

I want a parameter from Sys_Prop_Setting_version in android which gives information about the secure system setting, containing system preferences that applications can read but are not allowed to write. I searched this parameter in Android.Provider.Settings.System class, I didn't find it, but what I found is that this parameter is present in xamarin -API but not present in android-api I want this parameter how should I get it? what's the difference in these API's? for my application, I am using android-API marshmallow.

Shailesh
  • 657
  • 2
  • 13
  • 27

1 Answers1

1

I searched this parameter in Android.Provider.Settings.System class, I didn't find it, but what I found is that this parameter is present in xamarin -API but not present in android-api I want this parameter how should I get it?

This string Sys_Prop_Setting_version is removed from API level 23 to 24, you can checked the following documentations:

Android API Differences Report.

Class android.provider.Settings.Global.

Class android.provider.Settings.Secure.

Class android.provider.Settings.System.

what's the difference in these API's? for my application, I am using android-API marshmallow.

This Sys_Prop_Setting_version was presented in three different tables and the SysPropSettingVersion Field in Xamarin is the same one as the one in android.provider.Settings.Global table. Usually apis in Xamarin.Android are like the encapsulations of native android apis, they are the same, so this string field can also be found in Android.Provider.Settings.Secure and Android.Provider.Settings.System classes.

Since you're using android api marshmallow, it should be available. But I tested the code on android 6.0 device:

var sysprop = Android.Provider.Settings.Global.SysPropSettingVersion;
var settings = Android.Provider.Settings.Global.GetString(ApplicationContext.ContentResolver, sysprop);

It returns a null by my side, and I also tested:

Android.Provider.Settings.Secure.GetString(ApplicationContext.ContentResolver, Android.Provider.Settings.Secure.SysPropSettingVersion); and Android.Provider.Settings.System.GetString(ApplicationContext.ContentResolver, Android.Provider.Settings.System.SysPropSettingVersion);, all returns a null by my side. But if you want to find some other read only values in system secure settings, it works fine, for example:

Android.Provider.Settings.Secure.GetString(ApplicationContext.ContentResolver, Android.Provider.Settings.Secure.AndroidId);

Then I tried to figure out what is this value used for, by checking this document, I found nothing.

It seems that this Sys_Prop_Setting_version was used for getting the android api level of the device(not for sure, I saw some code used this to get OS version), if you want to do this, you can simply code like this:

var version = Android.OS.Build.VERSION.Release;
Grace Feng
  • 16,564
  • 2
  • 22
  • 45