2013-07-11 42 views
1

有沒有辦法在android的安全設置下從ownerinfo獲取devicename。我發現這種方式在android設置中以編程方式獲取ownerinfo

String deviceName = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.LOCK_PATTERN_OWNER_INFO); 

但在devlopers網站沒有這樣的常數可用。它是否被棄用?我已經Google搜索,但找不到合適的答案。

我使用的是Android 4.1版本

+0

三星Galaxy S2的'GT-I900'中的設備名稱?然後它的只是'字符串str = android.os.Build.MODEL;' – Slartibartfast

+0

你不是很清楚你在尋找什麼。您是否在尋找這裏列出的常量:http://developer.android.com/reference/android/os/Build.html – devnull

回答

1

使用

String ownerInfo = Settings.Secure.getString(getContentResolver(), "lock_screen_owner_info"); 

確保趕上SettingNotFoundException

+0

感謝您的解決方案,它的工作原理。雖然我認爲ownerinfo選項僅適用於比honeycomb更大的android版本。 –

+0

是的,我認爲這符合你自己說的_「我正在使用android 4.1版本_」。 – ozbek

0

字符串DEVICENAME = android.os.Build.MODEL;

相關問題