com.prey.json.actions.Imei.java Source code

Java tutorial

Introduction

Here is the source code for com.prey.json.actions.Imei.java

Source

/*******************************************************************************
 * Created by Orlando Aliaga
 * Copyright 2013 Fork Ltd. All rights reserved.
 * License: GPLv3
 * Full license at "/LICENSE"
 ******************************************************************************/
package com.prey.json.actions;

import java.util.List;

import org.json.JSONObject;

import android.content.Context;
import android.telephony.TelephonyManager;

import com.prey.PreyLogger;
import com.prey.actions.HttpDataService;
import com.prey.actions.observer.ActionResult;
import com.prey.json.JsonAction;

public class Imei extends JsonAction {

    public List<HttpDataService> get(Context ctx, List<ActionResult> list, JSONObject parameters) {
        PreyLogger.d("Ejecuting Imei Data.");
        List<HttpDataService> listResult = super.get(ctx, list, parameters);
        return listResult;
    }

    public HttpDataService run(Context ctx, List<ActionResult> lista, JSONObject parameters) {
        TelephonyManager mTelephonyMgr = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
        String imeiValue = mTelephonyMgr.getDeviceId();
        HttpDataService data = new HttpDataService("imei");
        data.setSingleData(imeiValue);
        return data;
    }

}