• Stars
    star
    321
  • Rank 130,123 (Top 3 %)
  • Language
    Java
  • Created over 11 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android Plugin Framework

Android Plugin Framework

This project is pre-mature and may be changed very frequently.

Introduction

Android Plugin Framework (APF) aims to providing a flexible, extensible framework, for Android applications, like OSGi for Java applications. App developers can design their Android applications in a totally new way: declar the interface of a application component, put the actual implementations of the component on the remote server, use APF library to load the actual implementations at runtime. In this way, app developers can dynamically update application components, or add features to an already installed application, without requiring the application being updated throught Android System Framework. A typical usage scenario can be skin: designers design various skins for an application according to pre-defined format and then put those skin files online. App users can then find and use skins through skin store, without having to installing a new version of the app.
Another using scenario is for game design: design the hard level of a game in a different package that can be dynamically load into the game. When an user passes the low level of the game, the app can load the hard level of game code using APF dynamically. The user gets a seemlessly upgrade experience.

The project consists 3 major components:

APF core

The core library to find, verify and load plugin code from remote servers. Now, the architecture and the remote server is still pre-mature and is subject to change, so it is not open sourced yet. But it will be soon.

Plugin Build Scripts

The instructions to create your own plugins. Check [Creating Your APF Plugin] for details.

Example

Example contains:

  1. Host application, Android Application Project.
  2. Plugin Interface, as an Android Library Project
  3. Plugin Implementation, as an Android Application Project

There is already an example plugin implementation signed by Umeng and hosted on Umeng's server side. If you want to try it out and have a different implementation, please contact xuxianming @ umeng.com

Creating Your APF Plugin

To create a effective APD plugin, you will need to design plugin interface first in an Android Library Project. Next, implement the declared interface in an Android Application Project.

Plugin Interface

  • Create an Android Library Project.
android create lib-project -n com_example_plugin1_ifs -t android-17 -k com.example.plugin1.ifs -p com.example.plugin1.ifs
  • Update ant.properties according to the template file apf-plugin-build/ant.properties.example
/apf-opensource/com.example.plugin1$ cat ../apf-plugin-build/ant.properties.example >> ant.properties 

The ant.properties looks like:

# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.

# This file is only used by the Ant script.

# You can use this to override default values such as
#  'source.dir' for the location of your java source folder and
#  'out.dir' for the location of your output folder.

# You can also use it define how the release builds are signed by declaring
# the following properties:
#  'key.store' for the location of your keystore and
#  'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
key.store=../apf-plugin-build/debug.keystore
key.store.password=android
key.alias=androiddebugkey
key.alias.password=android
  • Update build.xml according to the template file build.xml.plugin.ifs.example
apf-opensource/com.example.plugin1.ifs$ cp ../apf-plugin-build/build.xml.plugin.ifs.example build.xml 
  • Design the interface to be used by the host application. Check: src/com/example/plugin1/ifs/

Plugin Implementation

  • Create an Android Application Project.
android create project -n com_example_plugin1 -t android-17 -k com.example.plugin1 -p com.example.plugin1 -a PluginActivity
cd com.example.plugin1
android update project -p ./ --library ../com.example.plugin1.ifs
  • Update ant.properties according to the template file ant.properties.example

  • Update build.xml according to the template file build.xml.plugin.ifs.example

apf-opensource/com.example.plugin1$ cp ../apf-plugin-build/build.xml.plugin.example build.xml 
  • Design the interface to be used by the host application. src/com/example/plugin1/ifs/

Plugin Implementation project will be will packaged/exported as ${package-name}.apk and Plugin Interface project will be packaged to ${package-name}.ifs.jar.

For example, com.umeng.analytics.apk for plugin, and com.umeng.analytics.ifs.jar for interfaces declarations.

Build

> ant deploy

The output will be at ${project.dir}/bin/com.example.plugina.apk and ${project.dir}/bin/com.example.plugina.ifs.jar.

Note: if the plugin implementation projec ifself is a android library project, for example, like com.umeng.common, you need a little "hack" to the ant build system. First change ant.properties, change android.library=true to android.library=false. After successfully ant deploy, change it back to android.library=true, as is required by the upper stream application project.

Example

See [com.example.host] and [com.example.plugin1].

To Run the example:

ant 

Signing plugin

All plugins must be signed with private key. APF adopts similar mechanisms as Android app signing. See Signing Your Applications for help.

Sign the plugin apk

  1. Make sure that you can build your plugin interface and implementation with ant successfully before preceeding.
  2. Configure ant.properties. Add the content of ant.properties.example to your plugin implementation project's ant.properties.
  3. Use ant deploy to build the release apk package. This will build a release mode plugin apk called [project-name]-release.apk under bin/ directory.

Warning

When to release your plugin, remember to update the key and keystore. Do not use the example key store used here. Caution: Since APF is in very pre-mature state, it's architecture and server side design is subject to change very frequently. For now, APF provided by Umeng does not allow any plugin signed by third party. If you want to try this out and want to deploy your plugin on Umeng's platform, please develop your plugin first and contact us. After we check out that your plugin is secure, we can sign the plugin for you and host your plugin on Umeng's server. Please email to xuxianming at umeng.com. We will open source implementation of APF when it's architecture design is freezed.

More Repositories

1

umeng-muti-channel-build-tool

友盟渠道打包工具(windows .net 4.0)
C#
611
star
2

MultiFunctionAndroidDemo

友盟多功能Android Demo
Java
391
star
3

android_download_manager

multi-thread, broken-point-resume download library for Android
Java
208
star
4

UMAndroidSdkDemo

友盟+ 统计SDK/推送SDK/分享SDK 三合一 Demo项目
Java
194
star
5

React_Native_Compent

Objective-C
173
star
6

MultiFunctioniOSDemo

友盟多功能iOS Demo
Objective-C
111
star
7

umeng_community_android

友盟微社区Android SDK开源项目
Java
82
star
8

umeng-android-sdk-theme

themes and styles for umeng android sdk servivces / components.
Java
61
star
9

mp-demos

友盟+小程序统计sdk,小游戏统计sdk demo
JavaScript
46
star
10

UMengDemo

友盟+ 统计SDK/推送SDK/分享SDK 三合一 iOSDemo
Objective-C
35
star
11

umeng-social-for-cocos2d-x

umeng social cocos2d-x(3.x & 2.x) sdk
Objective-C
32
star
12

MultiFunctionAndroidMavenDemo-master

Java
26
star
13

Umeng_Analytics_PhoneGap_SDK

umeng analytics phoneGap sdk. welcom star.
Objective-C
22
star
14

umeng_shake_demo

友盟社会化组件摇一摇截屏分享demo
Java
16
star
15

PhoneGap_Component

Objective-C
16
star
16

Hybrid_Component

Objective-C
10
star
17

mvn-repo-umeng

maven repo for umeng sdk distributions
7
star
18

u3d_component_android

Java
5
star
19

umeng-uverify-demo

友盟+智能认证官方demo
Java
4
star
20

umeng-message

Umeng Push Service
4
star
21

UMengH5Demo

Objective-C
3
star
22

UmengRestApiUploadImageDemo

Java版RestAPi使用说明
Java
3
star
23

cocos2dx_Component

Objective-C
2
star
24

Link_Demo_Android

Java
2
star
25

CC_Demo_Android

友盟在线参数Android样例工程
Java
2
star
26

FeedbackiOSDemo

Feedback iOS Demo
Objective-C
2
star
27

umeng-JSON

C#
2
star
28

ald2uma

阿拉丁小游戏适配器
JavaScript
1
star
29

community_simplify

Java
1
star
30

u3d_component_ios

C++
1
star
31

cocos2dx_3x

C++
1
star
32

community_wb

Java
1
star
33

sharelink-jssdk-demo

link 唤起技术和追踪模块 api 使用说明
1
star
34

cocos2dx_Component_lua

C++
1
star
35

UmengRestApiPyDemo

Python
1
star
36

UMOnlineConfigiOSDemo

最新在线参数iOSDemo
Objective-C
1
star
37

umeng-Gzip

C#
1
star
38

UmengPointsDemo_JAVA

友盟Java版本积分接口、获取AccessToken接口Demo
Java
1
star
39

Link_Demo_iOS

友盟智能超链(iOS) 集成使用样例工程。
Objective-C
1
star