Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ServiceClass extends Service {
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- Log.i(TAG, "onStartCommand: ");
- // some work
- stopService(intent);
- return Service.START_NOT_STICKY;
- }
- @Nullable
- @Override
- public IBinder onBind(Intent intent) {
- Log.i(TAG, "onBind: ");
- return null;
- }
- @Override
- public void onDestroy() {
- Log.i(TAG, "onDestroy: ");
- super.onDestroy();
- }
- }
- startService(new Intent(MainActivity.this,ServiceClass.class));
- ANR in com.sample.service
- PID: 7381
- Reason: executing service com.sample.service/.ServiceClass
- Load: 0.93 / 0.73 / 0.82
- CPU usage from 59831ms to 0ms ago (2018-11-15 13:26:46.668 to 2018-11-15 13:27:46.500):
- 13% 1810/system_server: 8.7% user + 4.5% kernel / faults: 12123 minor
Add Comment
Please, Sign In to add comment