Java Code Examples for com.didi.virtualapk.PluginManager#getInstance()

The following examples show how to use com.didi.virtualapk.PluginManager#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From VirtualAPKDemo with Apache License 2.0 6 votes vote down vote up
private void loadPlugin(Context base) {
    PluginManager pluginManager = PluginManager.getInstance(base);
    File apk = new File(getExternalStorageDirectory(), "plugin.apk");
    if (apk.exists()) {
        try {
            pluginManager.loadPlugin(apk);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        Toast.makeText(getApplicationContext(),
                "SDcard根目录未检测到plugin.apk插件", Toast.LENGTH_SHORT).show();
    }
}
 
Example 2
Source File: MainActivity.java    From BlogDemo with Apache License 2.0 5 votes vote down vote up
/**
 * 加载插件
 *
 * @param pkg 插件包名
 * @param pluginFile 根目录插件文件名
 */
private void loadPlugin(String pkg, String pluginFile) {
  PluginManager pluginManager = PluginManager.getInstance(this);
  File apk = new File(Environment.getExternalStorageDirectory(), pluginFile);
  if (apk.exists()) {
    try {
      unInstallPlugin(pkg);
      pluginManager.loadPlugin(apk);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
 
Example 3
Source File: PluginContentResolver.java    From VirtualAPK with Apache License 2.0 4 votes vote down vote up
public PluginContentResolver(Context context) {
    super(context);
    mPluginManager = PluginManager.getInstance(context);
}
 
Example 4
Source File: LocalService.java    From VirtualAPK with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    mPluginManager = PluginManager.getInstance(this);
}