StringManolo

Service.java

May 9th, 2020
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. package com.stringmanolo.rs;
  2.  
  3. import android.app.Service;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.os.IBinder;
  7. import com.stringmanolo.rs.Conexion;
  8.  
  9. public class Servicio extends Service {
  10.     private static Context c;
  11.    
  12.     public void ServicioPrincipal() {
  13.         /* Conectar está definido en el archivo Conexion.java
  14.         Inicia la función lógica principal del programa */
  15.         Conexion.Conectar();
  16.     }
  17.    
  18.     @Override
  19.     public IBinder onBind(Intent intent) {
  20.         return null;
  21.     }
  22.    
  23.     @Override
  24.     public int onStartCommand(Intent paramIntent, int paramInt1, int paramInt2) {
  25.         c = this;
  26.         Conexion.Conectar();
  27.         return Service.START_STICKY;
  28.     }
  29.    
  30.     @Override
  31.     public void onDestroy() {
  32.         super.onDestroy();
  33.     }
  34.    
  35.     public static Context getContextOfApplication() {
  36.         return c;
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment