私はmy device as a admin
仕事を素晴らしいものにする作成アプリです。
しかし、私は私のときにいくつかのメッセージをトリガーしたいApplication uninstall from device.
ユーザー
remove from admin
が私のかどうかを知る方法
app Device admin is checked or not?
Android組み込みの管理アプリケーションのデモを使用しています。
アイデアをください。
私はmy device as a admin
仕事を素晴らしいものにする作成アプリです。
しかし、私は私のときにいくつかのメッセージをトリガーしたいApplication uninstall from device.
ユーザーremove from admin
が
私のかどうかを知る方法app Device admin is checked or not?
Android組み込みの管理アプリケーションのデモを使用しています。
アイデアをください。
DeviceAdminReceiver を拡張する必要があります。
public class DeviceAdmin extends DeviceAdminReceiver {
@Override
public void onEnabled(Context context, Intent intent) {
Log.i(this, "admin_receiver_status_enabled");
// admin rights
App.getPreferences().edit().putBoolean(App.ADMIN_ENABLED, true).commit(); //App.getPreferences() returns the sharedPreferences
}
@Override
public CharSequence onDisableRequested(Context context, Intent intent) {
return "admin_receiver_status_disable_warning";
}
@Override
public void onDisabled(Context context, Intent intent) {
Log.info(this, "admin_receiver_status_disabled");
// admin rights removed
App.getPreferences().edit().putBoolean(App.ADMIN_ENABLED, false).commit(); //App.getPreferences() returns the sharedPreferences
}
}
アプリのどこでも:
DevicePolicyManager mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName mAdminName = new ComponentName(this, DeviceAdmin.class);
if(mDPM != null &&mDPM.isAdminActive(mAdminName)) {
// admin active
}