Giter Club home page Giter Club logo

droidplugin's Introduction

Droid Plugin

中文文档

DroidPlugin is a new Plugin Framework developed and maintained by the Android app-store team at Qihoo 360 (NYSE:QIHU). It enables the host app run any third-party apk without installation, modification or repackage, which benefit a lot for collaborative development on Android.


##Problems to be solved:

  1. Unable to send Notification with customized Resouces,eg:

    a. Notification with customed RemoteLayout, which means Notification's contentViewtickerViewbigContentView and headsUpContentView must be null.

    b. Notification with icon customized by R.drawable.XXX. The framework will transform it to Bitmap instead.

  2. Unable to define individual Intent Filter for the plugged app's ServiceActivityBroadcastReceiver and ContentProvider. So the plugged app is invisible for the outside system and app.

  3. Unable to support all LaunchMode of Activity,thus the onNewIntent method can not be called.

  4. Without Hook to the Native layer, thus apk (e.g. a large part of games) with native code cannot be loaded.

##Features:

  1. Compatible to Android 2.3 and later versions
  2. Given its .apk file, the plugged app could be run either independently or as plugin of the host, NO source code needed.
  3. Unnecessary to register the plugged app's ServiceActivityBroadcastReceiverContentProvider in the host.
  4. The plugged app are recognized as Installed by the host and other plugged apps
  5. Very low level of code invasion, in deed just one line code to integrate DroidPlugin into the host app.
  6. Complete code level separation between host and plugged apps, only system level message passing method provide by Android allowed.
  7. All system API supported
  8. Resources management are also completely separated between host and plugged apps.
  9. Process management for plugged apps, idle processed of the plugged app will be timely recycled to guarantee minimum memory usage.
  10. Static broadcast of plugged app will be treated as dynamic, thus the static broadcasting will never be trigger if the plugged app are not activated.

##Usage:

####Integrate with the host apps

It is very simple integrate Droid Plugin to your proejct:

  1. Import Droid Plugin project to your project as a lib.

  2. Include following attributes in host's AndroidManifest.xml

     <application android:name="com.morgoo.droidplugin.PluginApplication" 
     			 android:label="@string/app_name"
     			 android:icon="@drawable/ic_launcher" 
    
  3. Or,if you use customized Application,add following code in the methods onCreate and attachBaseContext:

     @Override
     public void onCreate() {
         super.onCreate();
    
         PluginHelper.getInstance().applicationOnCreate(getBaseContext()); //must behind super.onCreate()
     }
       
     @Override
     protected void attachBaseContext(Context base) {
         PluginHelper.getInstance().applicationAttachBaseContext(base);
     }
    
  4. All provider's authorities value in DroidPlugin's Libraries\DroidPlugin\AndroidManifest.xml default to be com.morgoo.droidplugin_stub_P00, e.g. :

    <provider
        android:name="com.morgoo.droidplugin.stub.ContentProviderStub$StubP00"
        android:authorities="com.morgoo.droidplugin_stub_P00"
        android:exported="false"
        android:label="@string/stub_name_povider" />
    

    You'd better change it to avoid conflict with other instances, e.g.:

    <provider
        android:name="com.morgoo.droidplugin.stub.ContentProviderStub$StubP00"
        android:authorities="com.example.droidplugin_stub_P00"
        android:exported="false"
        android:label="@string/stub_name_povider" />
    

####Install、Uninstall or Upgrade the plugged app:

  1. Install/Upgrade,use this method:

     int PluginManager.getInstance().installPackage(String filepath, int flags);
    

    For installation, filepath set to path of the .apk file, and flags set to 0.

    For upgrade, filepath set to path of the .apk file, and flags set to PackageManagerCompat.INSTALL_REPLACE_EXISTING.

  2. Uninstall,use this method:

     int PluginManager.getInstance().deletePackage(String packageName,int flags);
    

    packageName is package name of the plugged app,flags = 0

  3. Activate

    Just use android's API, same for communication between components.

Remark:

Please feel free to report bugs or email for help.

Thanks:

Translated by Ming Song([email protected]

droidplugin's People

Contributors

cmzy avatar mikesongming avatar qihoo360github avatar

Watchers

simon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.