简体   繁体   中英

Android service not showing logs?

I am a bit confused,

it seems that my Service does not print logs,

the service starts regularly (I can debug it), I see all other logs,

but from the service no logs.

Please what am I missing here?

@Override
protected void onHandleIntent(Intent intent) {
    Log.e("TAG","Downlaoding devices list");//This should log something!

Chances are your IntentService is not getting called. try using the whole package name of the IntentService. I've seen this somewhere I'll post a link if I find it. Something like this...

Intent intent = new Intent(this/*Context*/,com.myapp.MyIntentService.class); //as opposed to // new Intent(this, MyIntentService.class); startService(intent);

Edit: I found the link. intentService : why my onHandleIntent is never called?

My solution was selecting "No filters" in logcat spinner instead of "Show only selected application". Then you can search for TAG or whatever you know it should be shown.

In Android Studio Logcat. Before running your code, 1) Select No Filters instead of Show selected applications 2) In the search box, type in your tag. 3) Now Run your code and all your logs will be displayed.

Note: It won't work if you enter your tag after running your code.

In my case which is Himax M2 Y12 phone, has a peculiarity in that my TAG SensorService is blocked for unknown reason.

I changed the TAG to GeoSensorService and now the logcat is showing.

My guess is they reserve the TAG for internal purposes, but I'd argue they shouldn't use such an innocent naming (they could've prefixed reserved TAGs with __ or something).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM