mindbirth / snap-services

A drop-in replacement for Android services, fully compatible with Android O
25 stars 10 forks source link

Service not started #11

Closed lFaustus closed 6 years ago

lFaustus commented 6 years ago

Good day sir, I have started using your library but it seems my service is not started. I followed your sample app. I have added SnapServicesContext.startup(getApplicationContext(), new SnapConfigOptions.Builder() .killSeparateProcess(true).setLogLevel(SnapLogger.VERBOSE).build()); in my application class, and in my main activity's onCreate Intent mIntent = new Intent(getApplicationContext(), TestService.class); mIntent.setAction("testservice"); SnapServicesContext.startService(mIntent);

Here's my TestService class content

public TestService(String name)
{
    super(name);
}

@Override
protected void onHandleIntent(Intent intent)
{
    Timber.i("OnHandleIntent");
}

@Override
protected void onStartCommand(Intent intent, int startId)
{
    super.onStartCommand(intent, startId);
    Timber.i("onStartCommand");
}
lFaustus commented 6 years ago

Service is now running, I just need to provide name in constructor