我正在尝试使用翻新版创建具有登录名的应用程序,但我不断收到错误消息:
访问被拒绝,无法找到属性“ ro.vendor.config.hw_vowifi”
这是我的登录课程:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_login);
dbHelper = new DBHelper(this);
permission();
userService = ApiUtils.getUserService();
btnLogin = (Button) findViewById(R.id.btnLogin);
et_mobile = (EditText) findViewById(R.id.et_mobile);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String mobile = et_mobile.getText().toString();
if(validateLogin(mobile)){
initlogin(mobile);
doLogin(mobile);
}
}
});
SharedPreferences prefs = getSharedPreferences("datastuff",
MODE_PRIVATE);
prefs = getSharedPreferences("datastuff", MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.clear();
editor.commit();
}
public void initlogin(String mobile) {
TelephonyManager tMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_NUMBERS) != PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
String mPhoneNumber = tMgr.getLine1Number();
//Toast.makeText(this, "PHONE NUMEBR "+mPhoneNumber, Toast.LENGTH_SHORT).show();
/* if(mPhoneNumber.equals(phonenumber))
{
logUser(phonenumber);
Intent intent=new Intent(Login.this,ListActivity.class);
startActivity(intent);
finishAffinity();
}
else
{
et_mobile.setError("Enter Your Phone Number First");
et_mobile.requestFocus();
}*/
}
private void logUser(String username) {
// TODO: Use the current user's information
// You can call any combination of these three methods
Crashlytics.setUserIdentifier(username);
Crashlytics.setUserEmail(username);
Crashlytics.setUserName(username);
}
public void permission()
{
String[] permission={Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_SMS,Manifest.permission.RECEIVE_SMS,Manifest.permission.READ_PHONE_STATE};
if(ContextCompat.checkSelfPermission(Login.this,
permission[0])== PackageManager.PERMISSION_GRANTED);
else
{
ActivityCompat.requestPermissions(Login.this,permission,1);
}
}
private boolean validateLogin(String mobile){
if(mobile == null || mobile.trim().length() == 0){
Toast.makeText(this, "Phone Number is required", Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
private void doLogin(final String mobile){
Call<ResObj> call = userService.login(mobile);
call.enqueue(new Callback<ResObj>() {
@Override
public void onResponse(Call<ResObj> call, Response<ResObj> response) {
if(response.isSuccessful()){
ResObj resObj = response.body();
if(resObj.getMessage().equals("true")){
Intent intent = new Intent(Login.this, ListActivity.class);
intent.putExtra("mobile", mobile);
startActivity(intent);
} else{
Toast.makeText(Login.this, "Phone Number is incorrect!", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onFailure(Call<ResObj> call, Throwable t) {
}
});
}
}
我认为该错误专门发生在onResponse方法中。
我也收到此错误: 无法解析系统文件中的数据使用情况 X.2IC:java.io.FileNotFoundException:/ proc / net / xt_qtaguid / stats(权限被拒绝)
我的预期结果是,我将使用数据库中的手机号码登录该应用程序。