Skip to content

Commit

Permalink
Update Android Intent
Browse files Browse the repository at this point in the history
  • Loading branch information
xgao authored and CatChen committed Sep 6, 2012
1 parent d03d24b commit 95285c9
Showing 1 changed file with 66 additions and 59 deletions.
125 changes: 66 additions & 59 deletions Doraemon/Android Intent.md
@@ -1,76 +1,83 @@
Online Markdown Editor
Input

Android Intent
============

1. Overview
------

* Android Intent的目的是为了给开发者提供一个通过js调用在android手机上启动一个intent的方法。
* Web Intent:
Web Intent是类似与android intent的一个机制,但是它的目的还是用于web,即在web上模拟android intent。
* Android Intent:
Android Intent是一个在android手机上启动intent的方式。
* 对于豌豆荚百宝袋而言,需要综合两种的特点,实现一种通过js的方式来在手机上启动一个intent。

Android Intent的目的是为了给开发者提供一个通过js调用在android手机上启动一个intent的方法。
Web Intent: Web Intent是类似与android intent的一个机制,但是它的目的还是用于web,即在web上模拟android intent。
Android Intent: Android Intent是一个在android手机上启动intent的方式。
对于豌豆荚百宝袋而言,需要综合两种的特点,实现一种通过js的方式来在手机上启动一个intent。
2. Design
------

interface AndroidIntent {
attribute DOMString action;
attribute DOMString type;
attribute DOMString data;
attribute DOMString category;
attribute DOMString component;
attribute DOMString extras;
attribute long flags;

void startActivity();
};
3. Implementation
interface AndroidIntent {
attribute DOMString action;
attribute DOMString type;
attribute DOMString data;
attribute DOMString category;
attribute DOMString component;
attribute DOMString extras;
attribute long flags;

var component = "com.wandoujia.phoenix2/com.wandoujia.phoenix2.ui.WelcomeActivity";
var extras = [];
void startActivity();
};

var item = {};
item.key = "phoenix.intent.extra.USER_AGENT";
item.value = "wandoujia";
extras.push(item);
3. Implementation
--------

var i = new AndroidIntent("","","",
JSON.stringify(category),
component,
JSON.stringify(extras));
// i.setFlags(0);
var component = "com.wandoujia.phoenix2/com.wandoujia.phoenix2.ui.WelcomeActivity";
var extras = [];

var item = {};
item.key = "phoenix.intent.extra.USER_AGENT";
item.value = "wandoujia";
extras.push(item);

i.startActivity();
4. 各个参数的含义与android intent的含义一致:
var i = new AndroidIntent("","","",
JSON.stringify(category),
component,
JSON.stringify(extras));
// i.setFlags(0);

action
i.startActivity();

ACTION_CALL
ACTION_EDIT
ACTION_MAIN
ACTION_SYNC
ACTIONBATTERYLOW
ACTIONHEADSETPLUG
ACTIONSCREENON
ACTIONTIMEZONECHANGED
type
4. 各个参数的含义与android intent的含义一致:
----
* action
- ACTION_CALL
- ACTION_EDIT
- ACTION_MAIN
- ACTION_SYNC
- ACTION_BATTERY_LOW
- ACTION_HEADSET_PLUG
- ACTION_SCREEN_ON
- ACTION_TIMEZONE_CHANGED

显式指定Intent的数据类型(MIME)
data
执行动作要操作的数据
category
* type
- 显式指定Intent的数据类型(MIME)
* data
- 执行动作要操作的数据
* category
- 被执行动作的附加信息,格式为json

* Constant
- CATEGORY_BROWSABLE
- CATEGORY_GADGET
- CATEGORY_HOME
- CATEGORY_LAUNCHER
- CATEGORY_PREFERENCE

被执行动作的附加信息,格式为json
Constant


CATEGORY_BROWSABLE
CATEGORY_GADGET
CATEGORY_HOME
CATEGORY_LAUNCHER
CATEGORY_PREFERENCE
component
* component
- 指定Intent的的目标组件的类名称
* extras
- 其它所有附加信息的集合,格式为json
* flags
- 控制启动参数

指定Intent的的目标组件的类名称
extras
其它所有附加信息的集合,格式为json
flags
控制启动参数
Copyright ? 2010 CtrlShift.net Powered by Markdown Engine "Showdown". Convert text 3 ms

0 comments on commit 95285c9

Please sign in to comment.