Guest User

Untitled

a guest
Jan 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class MyService extends Service {
  2. private static final String TAG = "MyService";
  3.  
  4. @Override
  5. public void onCreate() {
  6. Toast.makeText(this, "My Service Created", 0).show();
  7. }
  8.  
  9. @Override
  10. public void onDestroy() {
  11. Toast.makeText(this, "My Service Stopped", 0).show();
  12. Log.v(TAG, "onDestroy");
  13. }
  14.  
  15. public int onStartCommand(Intent intent, int flags, int startId) {
  16.  
  17. Toast.makeText(this, "On Start Command - service started", 0).show();
  18. Log.v(TAG, "onStart");
  19. **return START_STICKY;**
  20.  
  21. }
  22.  
  23. @Override
  24. public IBinder onBind(Intent intent) {
  25. return null;
  26. }
  27.  
  28. }
Add Comment
Please, Sign In to add comment