如您所知,Android开发者:
从2017年3月1日开始,Google Play将阻止发布任何新的应用或更新,其中PreferenceActivity类可能容易受到碎片注入攻击
在页面https://support.google.com/faqs/answer/7188427中,它提供了有关如何修复此漏洞的一些建议但是使用Xamarin开发的应用程序呢?
我无法找到任何相关信息。它说我受影响的类是SettingActivity,它继承自PreferenceActivity,我的类SettingActivity是这样的:
[Activity(
Label = "@string/ApplicationName",
Icon = "@drawable/ic_launcher",
Theme = "@android:style/Theme.Holo.Light",
ParentActivity = typeof(MainActivity))]
[IntentFilter(
new [] {Intent.ActionManageNetworkUsage},
Categories= new [] {Intent.CategoryDefault}
)]
public class SettingsActivity : PreferenceActivity
{
public static readonly string KeyWifiOnly = "pref_wifi_only";
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
AddPreferencesFromResource(Resource.Xml.preferences);
ActionBar.SetHomeButtonEnabled(true);
ActionBar.SetDisplayHomeAsUpEnabled(true);
PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false);
SetupNetworkPreferences();
}
private void SetupNetworkPreferences()
{
var prefs = PreferenceManager.GetDefaultSharedPreferences(this);
ListPreference list = FindPreference(
AppSettings.PreferenceNetworkProvider) as ListPreference;
list.SetEntries(
Enum.GetNames(typeof(AppSettings.FtpHostNetwork)));
list.SetEntryValues(Enum
.GetValues(typeof(AppSettings.FtpHostNetwork))
.Cast<int>()
.Select(x => x.ToString())
.ToArray());
}
protected override void OnResume()
{
base.OnResume();
var tracker = (Application as App).Tracker;
tracker.Screen("PantallaPreferencias");
}
}
答案 0 :(得分:0)
正如Mike Ma在评论中所建议的那样:
添加exported = false propierty工作正常。
[Activity( Label = "@string/ApplicationName", Exported =false, Icon = "@drawable/ic_launcher", Theme = "@android:style/Theme.Holo.Light", ParentActivity = typeof(MainActivity))]