I'm trying to get my Services object and I'm doing that with this code
public class Service extends android.app.Service {
private Handler handler = new Handler();
static Service SELF;
MainActivity mainActivity;
BluetoothSPP bluetoothSPP;
public static Service getInstance() {
return SELF;
}
@Override
public void onCreate() {
super.onCreate();
SELF = this;
}
}
but after starting service getInstance()
gives null. why?