Example usage for android.os UserManager isUserAGoat

List of usage examples for android.os UserManager isUserAGoat

Introduction

In this page you can find the example usage for android.os UserManager isUserAGoat.

Prototype

public boolean isUserAGoat() 

Source Link

Document

Used to determine whether the user making this call is subject to teleportations.

Usage

From source file:ch.uzh.supersede.feedbacklibrary.FeedbackActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_feedback);

    UserManager userManager = (UserManager) getApplicationContext().getSystemService(Context.USER_SERVICE);
    if (userManager.isUserAGoat()) {
        Log.v(TAG, "The user IS a goat and subject to teleportations");
    } else {//from   w  w w  .j a  v  a2 s  . co  m
        Log.v(TAG, "The user IS NOT a goat and subject to teleportations");
    }

    Intent intent = getIntent();
    // Get the default image path for the screenshot if present
    defaultImagePath = intent.getStringExtra(DEFAULT_IMAGE_PATH);
    // Get the configuration type
    isPush = intent.getBooleanExtra(IS_PUSH_STRING, true);
    // Get values related to a pull configuration
    selectedPullConfigurationIndex = intent.getLongExtra(SELECTED_PULL_CONFIGURATION_INDEX_STRING, -1);
    String jsonString = intent.getStringExtra(JSON_CONFIGURATION_STRING);

    // Initialization based on the type of configuration, i.e., if it is push or pull
    language = intent.getStringExtra(EXTRA_KEY_LANGUAGE);
    baseURL = intent.getStringExtra(EXTRA_KEY_BASE_URL);
    if (!isPush && selectedPullConfigurationIndex != -1 && jsonString != null) {
        // The feedback activity is started on behalf of a triggered pull configuration
        Log.v(TAG, "The feedback activity is started via a PULL configuration");

        // Save the current configuration under FeedbackActivity.CONFIGURATION_DIR}/FeedbackActivity.JSON_CONFIGURATION_FILE_NAME
        Utils.saveStringContentToInternalStorage(getApplicationContext(), CONFIGURATION_DIR,
                JSON_CONFIGURATION_FILE_NAME, jsonString, MODE_PRIVATE);
        orchestratorConfigurationItem = new Gson().fromJson(jsonString, OrchestratorConfigurationItem.class);
        initModel();
        initView();
    } else {
        // The feedback activity is started on behalf of the user
        Log.v(TAG, "The feedback activity is started via a PUSH configuration");

        // TODO: remove before release
        //initOfflineConfiguration();

        // TODO: uncomment before release
        // Get the application id and language
        init(intent.getLongExtra(EXTRA_KEY_APPLICATION_ID, -1L), baseURL, language);
    }
}