本文整理汇总了Java中com.google.android.vending.expansion.downloader.DownloaderClientMarshaller.CreateStub方法的典型用法代码示例。如果您正苦于以下问题:Java DownloaderClientMarshaller.CreateStub方法的具体用法?Java DownloaderClientMarshaller.CreateStub怎么用?Java DownloaderClientMarshaller.CreateStub使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.vending.expansion.downloader.DownloaderClientMarshaller
的用法示例。
在下文中一共展示了DownloaderClientMarshaller.CreateStub方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: downloadExpansionFiles
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; //导入方法依赖的package包/类
public void downloadExpansionFiles(Activity activity, ObbDownloadListener listener) {
try {
mListener = listener;
mIsFinished = false;
// Build an Intent to start this activity from the Notification
Intent notifierIntent = new Intent(activity, activity.getClass());
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(activity, 0, notifierIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
// Start the download service (if required)
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(activity, pendingIntent,
ObbDownloadService.class);
// If download has started, initialize a ProgressDialog to show
// download progress
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
// This is where you do set up to display the download
// progress (next step)
// Instantiate a member instance of IStub
Log.i("APKExpansionDownloader", "Try to download obb files");
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, ObbDownloadService.class);
// Create and show the progress dialog
mDownloadProgressDlg = new MyProgressDialog(activity);
mDownloadProgressDlg.show();
}
// No need to download obb files
else {
Log.i("APKExpansionDownloader", "No need to download obb files");
downloadSuccess();
}
} catch (NameNotFoundException e) {
e.printStackTrace();
downloadFailed();
}
}
示例2: checkDownload
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; //导入方法依赖的package包/类
private void checkDownload() {
if (!expansionFilesDelivered()) {
AliteLog.d("File does not exist!", "Expansion file does not exist. Downloading...");
Intent notifierIntent = new Intent(this, getClass());
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(this, 0, notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
try {
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this, pendingIntent,
AliteDownloaderService.class);
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
downloaderClientStub = DownloaderClientMarshaller.CreateStub(this, AliteDownloaderService.class);
setContentView(R.layout.activity_start_manager);
return;
}
} catch (NameNotFoundException e) {
setStatus("Error while downloading expansion file: " + e.getMessage());
AliteLog.e("Error while Downloading Expansions", "Name not Found: " + e.getMessage(), e);
}
}
AliteFiles.performMount(this,
new IMethodHook() {
private static final long serialVersionUID = -6200281383445218241L;
@Override
public void execute(float deltaTime) {
startGame();
}
}, new ErrorHook());
}
示例3: call
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; //导入方法依赖的package包/类
@Override
public FREObject call(FREContext context, FREObject[] args) {
try {
Intent launchIntent = context.getActivity().getIntent();
Intent notificationIntent = new Intent(context.getActivity(), context.getActivity().getClass());
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationIntent.setAction(launchIntent.getAction());
if (launchIntent.getCategories() != null) {
for (String category : launchIntent.getCategories()) {
notificationIntent.addCategory(category);
}
}
PendingIntent pendingIntent = PendingIntent.getActivity(context.getActivity(), 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(context.getActivity(), pendingIntent, XAPKDownloaderService.class);
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
XAPKContext.stub = DownloaderClientMarshaller.CreateStub(XAPKContext.client, XAPKDownloaderService.class);
XAPKContext.stub.connect(context.getActivity());
return null;
} else {
context.dispatchStatusEventAsync(DownloadEventCode.COMPLETE.getName(), StatusEventLevel.DOWNLOAD.getName());
}
} catch (NameNotFoundException e) {
FREUtils.logEvent(context, LogLevel.FATAL, "Cannot find own package! MAYDAY!");
e.printStackTrace();
}
return null;
}
示例4: onCreate
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
// checking for files is already being done outside of this class
// this activity should only be created if files need to be downloaded
// "Build an Intent to start this activity from the Notification"
// using this activity rather than MainActivity
// hoping to handle progress and status within this class
Intent notifierIntent = new Intent(this, ((Object)this).getClass());
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Timber.d("CREATED PENDING INTENT");
try {
// "Start the download service (if required)"
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this, pendingIntent, LigerDownloaderService.class);
// "If download has started, initialize this activity to show download progress"
// notification probably limited to debug output at this time
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
// "Instantiate a member instance of IStub"
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, LigerDownloaderService.class);
// "Inflate layout that shows download progress"
// currently no ui for progress/status
// setContentView(R.layout.downloader_ui);
Timber.d("CLIENT MARSHALLER CREATED STUB");
return;
} else {
Timber.d("CLIENT MARSHALLER SAYS DOWNLOAD NOT REQUIRED");
}
} catch (PackageManager.NameNotFoundException nnfe) {
Timber.e("CLASS PASSED TO DOWNLOAD SERVICE NOT FOUND?");
nnfe.printStackTrace();
}
// as currently implemented, main activity will already have started
// uncertain if this needs to perform some sort of notification?
}