Example usage for android.app Service onCreate

List of usage examples for android.app Service onCreate

Introduction

In this page you can find the example usage for android.app Service onCreate.

Prototype

public void onCreate() 

Source Link

Document

Called by the system when the service is first created.

Usage

From source file:com.test.onesignal.MainOneSignalClassRunner.java

@Test
public void shouldSyncPendingChangesFromSyncService() throws Exception {
    OneSignalInit();//  ww  w  . j  a va2  s  . co m
    threadAndTaskWait();

    OneSignal.sendTag("key", "value");
    OneSignalPackagePrivateHelper.SyncService_onTaskRemoved();
    OneSignalPackagePrivateHelper.resetRunnables();
    threadAndTaskWait();
    Assert.assertEquals(1, ShadowOneSignalRestClient.networkCallCount);

    StaticResetHelper.restSetStaticFields();

    Service service = new SyncService();
    service.onCreate();
    threadAndTaskWait();
    Assert.assertEquals("value", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").getString("key"));
}