Search in sources :

Example 16 with Service

use of android.app.Service in project DroidPlugin by DroidPluginTeam.

the class ServcesManager method handleOnStartOne.

private void handleOnStartOne(Intent intent, int flags, int startIds) throws Exception {
    ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = mNameService.get(info.name);
        if (service != null) {
            ClassLoader classLoader = getClassLoader(info.applicationInfo);
            intent.setExtrasClassLoader(classLoader);
            Object token = findTokenByService(service);
            Integer integer = mServiceTaskIds.get(token);
            if (integer == null) {
                integer = -1;
            }
            int startId = integer + 1;
            mServiceTaskIds.put(token, startId);
            int res = service.onStartCommand(intent, flags, startId);
            QueuedWorkCompat.waitToFinish();
        }
    }
}
Also used : ServiceInfo(android.content.pm.ServiceInfo) Service(android.app.Service)

Example 17 with Service

use of android.app.Service in project DroidPlugin by DroidPluginTeam.

the class ServcesManager method handleOnTaskRemovedOne.

private void handleOnTaskRemovedOne(Intent intent) throws Exception {
    if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
        ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
        if (info != null) {
            Service service = mNameService.get(info.name);
            if (service != null) {
                ClassLoader classLoader = getClassLoader(info.applicationInfo);
                intent.setExtrasClassLoader(classLoader);
                service.onTaskRemoved(intent);
                QueuedWorkCompat.waitToFinish();
            }
            QueuedWorkCompat.waitToFinish();
        }
    }
}
Also used : ServiceInfo(android.content.pm.ServiceInfo) Service(android.app.Service)

Example 18 with Service

use of android.app.Service in project DroidPlugin by DroidPluginTeam.

the class ServcesManager method onBind.

public IBinder onBind(Context context, Intent intent) throws Exception {
    Intent targetIntent = intent.getParcelableExtra(Env.EXTRA_TARGET_INTENT);
    if (targetIntent != null) {
        ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(targetIntent, 0);
        Service service = mNameService.get(info.name);
        if (service == null) {
            handleCreateServiceOne(context, intent, info);
        }
        return handleOnBindOne(targetIntent);
    }
    return null;
}
Also used : ServiceInfo(android.content.pm.ServiceInfo) Service(android.app.Service) Intent(android.content.Intent)

Example 19 with Service

use of android.app.Service in project DroidPlugin by DroidPluginTeam.

the class ServcesManager method handleOnUnbindOne.

private boolean handleOnUnbindOne(Intent intent) throws Exception {
    ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = mNameService.get(info.name);
        if (service != null) {
            ClassLoader classLoader = getClassLoader(info.applicationInfo);
            intent.setExtrasClassLoader(classLoader);
            return service.onUnbind(intent);
        }
    }
    return false;
}
Also used : ServiceInfo(android.content.pm.ServiceInfo) Service(android.app.Service)

Example 20 with Service

use of android.app.Service in project DroidPlugin by DroidPluginTeam.

the class ServcesManager method onRebind.

public void onRebind(Context context, Intent intent) throws Exception {
    Intent targetIntent = intent.getParcelableExtra(Env.EXTRA_TARGET_INTENT);
    if (targetIntent != null) {
        ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(targetIntent, 0);
        Service service = mNameService.get(info.name);
        if (service == null) {
            handleCreateServiceOne(context, intent, info);
        }
        handleOnRebindOne(targetIntent);
    }
}
Also used : ServiceInfo(android.content.pm.ServiceInfo) Service(android.app.Service) Intent(android.content.Intent)

Aggregations

Service (android.app.Service)24 ServiceInfo (android.content.pm.ServiceInfo)12 Intent (android.content.Intent)8 Handler (android.os.Handler)3 SyncService (com.onesignal.SyncService)3 EventManager (roboguice.event.EventManager)3 Activity (android.app.Activity)2 Application (android.app.Application)2 IntentService (android.app.IntentService)2 Context (android.content.Context)2 Configuration (android.content.res.Configuration)2 IBinder (android.os.IBinder)2 Injector (com.google.inject.Injector)2 Test (org.junit.Test)2 SuppressLint (android.annotation.SuppressLint)1 AlarmManager (android.app.AlarmManager)1 Notification (android.app.Notification)1 NotificationManager (android.app.NotificationManager)1 SearchManager (android.app.SearchManager)1 BroadcastReceiver (android.content.BroadcastReceiver)1