简体   繁体   中英

Detect if “Find my Mobile” is activated on Samsung Android phones?

I have an app that needs to behave differently depending on whether the "Find my Mobile" feature is enabled on a Samsung phone.

Currently only the Galaxy S5 has this feature enabled, as far as I know, but it is known to exist within the codebase and hardware of many Samsung phones, and a software update could easily activate it on various phones.

I've deodexed the framework.jar file searching for some custom Samsung hidden/internal API that would reveal whether this is activated, but that has, to this point, failed to work. I've also peered into the security settings code within the Settings application itself, but have found code dependent upon several imports which are not included or available (to my knowledge) in the standard Android API.

Is there a way to detect via code within an Android app, possibly using hidden or internal APIs, whether the Find my Mobile feature is enabled on Samsung devices?

It turns out I was on the brink of figuring this out myself, despite having spent four or five hours on the problem in the past few days.

After digging through a decompiled version of Samsung's S5 settings apps, I found two key strings for system settings which control these features: lock_my_mobile and remote_control .

They're actual system settings, so can be easily read as such.

Settings.System.getInt(getContentResolver(), "lock_my_mobile", 0);
Settings.System.getInt(getContentResolver(), "remote_control", 0);

lock_my_mobile is 1 if the "Reactivation lock" is enabled. remote_control is 1 if "Remote controls" are enabled. They are 0 if disabled.

Unfortunately, this exists as a magic string, and isn't accessible through any of the final String literals in Settings.System . Oh well - at least it's there, and at least it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM