Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 3f8472c

Browse files
authored
[Tizen] Fixed getting the device type (#12133)
1 parent 6d8f335 commit 3f8472c

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Xamarin.Forms.Platform.Tizen/Forms.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,27 @@ public static class Forms
104104

105105
static Lazy<string> s_deviceType = new Lazy<string>(() =>
106106
{
107-
TSystemInfo.TryGetValue("http://tizen.org/system/device_type", out string deviceType);
107+
if (!TSystemInfo.TryGetValue("http://tizen.org/system/device_type", out string deviceType))
108+
{
109+
// Since, above key("http://tizen.org/system/device_type") is not available on Tizen 4.0, we uses profile to decide the type of device on 4.0.
110+
var profile = GetProfile();
111+
if (profile == "mobile")
112+
{
113+
deviceType = "Mobile";
114+
}
115+
else if (profile == "tv")
116+
{
117+
deviceType = "TV";
118+
}
119+
else if (profile == "wearable")
120+
{
121+
deviceType = "Wearable";
122+
}
123+
else
124+
{
125+
deviceType = "Unknown";
126+
}
127+
}
108128
return deviceType;
109129
});
110130

0 commit comments

Comments
 (0)