Skip to content

Instantly share code, notes, and snippets.

@xadh00m
xadh00m / BackgroundManager.java
Last active March 1, 2023 17:49
BackgroundManager
package com.android.utils;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.os.Handler;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
// create the dependency list
DependencyList dependencyList;
// (...gather all required dependencies and add them to the list...)
// create the plugin instance
Plugin* plugin = createPlugin();
// create a shared pointer managing the lifetime of the plugin and its dependencies
PluginPtr pluginPtr(plugin, DependencyDeleter<plugin>(dependencyList));
// Type definition for a list of boost::any instances.
typedef std::vector DependencyList;
// Stores all dependencies
template struct DependencyDeleter
{
// Constructor is initialized with the list of dependencies
DependencyDeleter(DependencyList dependencies) : mDependencies(dependencies)
{}