use of com.connectsdk.core.AppInfo in project butter-android by butterproject.
the class NetcastTVService method getApplications.
private void getApplications(int type, int number, final AppListListener listener) {
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
String strObj = (String) response;
JSONArray applicationArray = parseApplicationsXmlToJSON(strObj);
List<AppInfo> appList = new ArrayList<AppInfo>();
for (int i = 0; i < applicationArray.length(); i++) {
try {
final JSONObject appJSON = applicationArray.getJSONObject(i);
AppInfo appInfo = new AppInfo() {
{
setId(appJSON.getString("id"));
setName(appJSON.getString("title"));
}
};
appList.add(appInfo);
} catch (JSONException e) {
e.printStackTrace();
}
}
Util.postSuccess(listener, appList);
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
String requestURL = getUDAPRequestURL(UDAP_PATH_DATA, TARGET_APPLIST_GET, String.valueOf(type), "0", String.valueOf(number));
ServiceCommand<ResponseListener<Object>> command = new ServiceCommand<ResponseListener<Object>>(this, requestURL, null, responseListener);
command.setHttpMethod(ServiceCommand.TYPE_GET);
command.send();
}
use of com.connectsdk.core.AppInfo in project butter-android by butterproject.
the class WebOSTVService method launchInputPicker.
@Override
public void launchInputPicker(final AppLaunchListener listener) {
final AppInfo appInfo = new AppInfo() {
{
setId("com.webos.app.inputpicker");
setName("InputPicker");
}
};
launchAppWithInfo(appInfo, null, new AppLaunchListener() {
@Override
public void onSuccess(LaunchSession object) {
listener.onSuccess(object);
}
@Override
public void onError(ServiceCommandError error) {
appInfo.setId("com.webos.app.inputmgr");
launchAppWithInfo(appInfo, null, listener);
}
});
}
use of com.connectsdk.core.AppInfo in project butter-android by butterproject.
the class WebOSTVService method launchHulu.
@Override
public void launchHulu(String contentId, Launcher.AppLaunchListener listener) {
JSONObject params = new JSONObject();
try {
params.put("contentId", contentId);
} catch (JSONException e) {
e.printStackTrace();
}
AppInfo appInfo = new AppInfo() {
{
setId("hulu");
setName("Hulu");
}
};
launchAppWithInfo(appInfo, params, listener);
}
use of com.connectsdk.core.AppInfo in project butter-android by butterproject.
the class WebOSTVService method launchAppStore.
@Override
public void launchAppStore(String appId, AppLaunchListener listener) {
AppInfo appInfo = new AppInfo("com.webos.app.discovery");
appInfo.setName("LG Store");
JSONObject params = new JSONObject();
if (appId != null && appId.length() > 0) {
String query = String.format("category/GAME_APPS/%s", appId);
try {
params.put("query", query);
} catch (JSONException e) {
e.printStackTrace();
}
}
launchAppWithInfo(appInfo, params, listener);
}
use of com.connectsdk.core.AppInfo in project butter-android by butterproject.
the class WebOSTVService method launchNetflix.
@Override
public void launchNetflix(String contentId, Launcher.AppLaunchListener listener) {
JSONObject params = new JSONObject();
String netflixContentId = "m=http%3A%2F%2Fapi.netflix.com%2Fcatalog%2Ftitles%2Fmovies%2F" + contentId + "&source_type=4";
try {
params.put("contentId", netflixContentId);
} catch (JSONException e) {
e.printStackTrace();
}
AppInfo appInfo = new AppInfo() {
{
setId("netflix");
setName("Netflix");
}
};
launchAppWithInfo(appInfo, params, listener);
}
Aggregations