|
@ -0,0 +1,45 @@
|
|
1
|
package com.ai.ipu.func;
|
|
2
|
|
|
3
|
import org.json.JSONArray;
|
|
4
|
import org.json.JSONException;
|
|
5
|
|
|
6
|
import com.ai.ipu.mobile.frame.IIpuMobile;
|
|
7
|
import com.ai.ipu.mobile.frame.plugin.Plugin;
|
|
8
|
|
|
9
|
import android.content.Intent;
|
|
10
|
|
|
11
|
public class OpenOtherApp extends Plugin {
|
|
12
|
|
|
13
|
public OpenOtherApp(IIpuMobile ipumobile) {
|
|
14
|
super(ipumobile);
|
|
15
|
|
|
16
|
}
|
|
17
|
|
|
18
|
public void openIPUFromOtherApp(JSONArray params) {
|
|
19
|
try {
|
|
20
|
String pageAction = params.getString(0);
|
|
21
|
Intent intent = new Intent();
|
|
22
|
intent.setClassName("com.ai.ipu.display", "com.ai.ipu.display.MainActivity");
|
|
23
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
24
|
intent.putExtra("pageAction", pageAction);
|
|
25
|
|
|
26
|
if(params.length() > 1) {
|
|
27
|
JSONArray array = params.getJSONArray(1);
|
|
28
|
String pageParams = array.getString(0);
|
|
29
|
if (pageParams != null && pageParams.length() > 0) {
|
|
30
|
intent.putExtra("pageParams", pageParams);
|
|
31
|
}
|
|
32
|
|
|
33
|
String contextParams = array.getString(1);
|
|
34
|
if (contextParams != null && contextParams.length() > 0) {
|
|
35
|
intent.putExtra("contextParams", contextParams);
|
|
36
|
}
|
|
37
|
}
|
|
38
|
|
|
39
|
context.startActivity(intent);
|
|
40
|
} catch (JSONException e) {
|
|
41
|
e.printStackTrace();
|
|
42
|
}
|
|
43
|
}
|
|
44
|
|
|
45
|
}
|