我正在获取IMEI和设备ID,所以我在这里得到一个问题getDeviceId()已被弃用.
TelephonyManager tm = (TelephonyManager)
getSystemService(this.TELEPHONY_SERVICE);
imei = tm.getDeviceId();
device = Settings.Secure.getString(this.getContentResolver(),
Settings.Secure.ANDROID_ID);
Run Code Online (Sandbox Code Playgroud) 我按照这个来读取android中的JSON数据
我在那里将结果数据传递给另一个活动
public class MainAct1 extends Activity {
private static String urlString;
private static final String My_TAG= "Log Status";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.data);
if(Dcon.isInternetAvailable(this))
{
try {
urlString = "https://example.net/api_json";
new ProcessJSON(this).execute();
}
catch (Exception e) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainAct1.this);
builder.setMessage("Note: Your Server ID is Invalid \n Please check the Server Status");
builder.setTitle("Please Check Server Details");
builder.setPositiveButton("OK",null);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); …Run Code Online (Sandbox Code Playgroud)