Guest User

Untitled

a guest
Nov 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public class ServiceClass extends Service {
  2.  
  3. @Override
  4. public int onStartCommand(Intent intent, int flags, int startId) {
  5. Log.i(TAG, "onStartCommand: ");
  6. // some work
  7. stopService(intent);
  8. return Service.START_NOT_STICKY;
  9.  
  10. }
  11.  
  12. @Nullable
  13. @Override
  14. public IBinder onBind(Intent intent) {
  15. Log.i(TAG, "onBind: ");
  16. return null;
  17. }
  18.  
  19. @Override
  20. public void onDestroy() {
  21.  
  22. Log.i(TAG, "onDestroy: ");
  23. super.onDestroy();
  24.  
  25. }
  26. }
  27.  
  28. startService(new Intent(MainActivity.this,ServiceClass.class));
  29.  
  30. ANR in com.sample.service
  31. PID: 7381
  32. Reason: executing service com.sample.service/.ServiceClass
  33. Load: 0.93 / 0.73 / 0.82
  34. CPU usage from 59831ms to 0ms ago (2018-11-15 13:26:46.668 to 2018-11-15 13:27:46.500):
  35. 13% 1810/system_server: 8.7% user + 4.5% kernel / faults: 12123 minor
Add Comment
Please, Sign In to add comment