Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mSecurityInputMethodService is null in logcat

I wrote a little android app that should display the current location (last known location) of the smartphone. Although I copied the example code, and tried several other solutions, It seems to have the same error every time. My app consists of a button. Pressing the button should log the longitude and latitude, but only logs "mSecurityInputMethodService is null".

Here's the MainActivity.java:

public class MainActivity extends Activity {
int response;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onbutclick();
        }
    });

}
public void onbutclick(){
    LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
    if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){
        Location loc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if(loc != null){
            Log.d("Latitude",Double.toString(loc.getLatitude()));
            Log.d("Longitude",Double.toString(loc.getLongitude()));
        }

    }else{
        ActivityCompat.requestPermissions(this,new String[] {Manifest.permission.ACCESS_FINE_LOCATION},response);
        Intent inte = getIntent();
        finish();
        startActivity(inte);
    }
}

I also used <uses-permission> in the Manifest file. I would really appreciate an explanation what does "mSecurityInputMethodService is null" really means.

like image 226
Fe Ri Avatar asked Jul 26 '16 10:07

Fe Ri


2 Answers

For my Huawei device the following helps:

Dial:

*#*#2846579#*#*

and a hidden menu is shown. Go to "Background Setting" -> "Log setting" and enable the log levels.

like image 118
Klatschen Avatar answered Oct 20 '22 02:10

Klatschen


Huawei Phones disable logcat, a small improvement on the above answer

Dial:

*#*#2846579#*#*

and a hidden menu is shown. Go to "Background Setting" -> "Log setting" and enable the log levels.

Specifically enable: AP Log, Charge Log and Sleep Log.

Source: https://www.xda-developers.com/huawei-phones-disable-logcat-heres-how-to-restore-access/

like image 32
Ed Walpole Avatar answered Oct 20 '22 03:10

Ed Walpole