本文整理汇总了Java中com.google.android.vending.expansion.downloader.DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED属性的典型用法代码示例。如果您正苦于以下问题:Java DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED属性的具体用法?Java DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED怎么用?Java DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.vending.expansion.downloader.DownloaderClientMarshaller
的用法示例。
在下文中一共展示了DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: launchDownloader
private void launchDownloader() {
try {
Intent launchIntent = SampleDownloaderActivity.this
.getIntent();
Intent intentToLaunchThisActivityFromNotification = new Intent(
SampleDownloaderActivity
.this, SampleDownloaderActivity.this.getClass());
intentToLaunchThisActivityFromNotification.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentToLaunchThisActivityFromNotification.setAction(launchIntent.getAction());
if (launchIntent.getCategories() != null) {
for (String category : launchIntent.getCategories()) {
intentToLaunchThisActivityFromNotification.addCategory(category);
}
}
if (DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
PendingIntent.getActivity(SampleDownloaderActivity
.this,
0, intentToLaunchThisActivityFromNotification,
PendingIntent.FLAG_UPDATE_CURRENT),
SampleDownloaderService.class) != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
initializeDownloadUI();
return;
} // otherwise we fall through to starting the movie
} catch (NameNotFoundException e) {
Log.e(LOG_TAG, "Cannot find own package! MAYDAY!");
e.printStackTrace();
}
}
示例2: downloadExpansionFiles
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();
}
}
示例3: startDownloadServiceIfRequired
public static int startDownloadServiceIfRequired() {
if(expansionFilesDelivered() == 1)
return 0;
// Build an Intent to start this activity from the Notification
Intent notifierIntent = new Intent(mainContext, mainActivity.getClass());
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(mainContext, 0,
notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
int startResult = 0;
try {
startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(mainContext,
pendingIntent, ExtensionDownloaderService.class);
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
Extension.mainActivity.runOnUiThread(new Runnable() {
public void run() {
downloaderClient = new DownloaderClientImpl();
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(downloaderClient,
ExtensionDownloaderService.class);
}
});
}
}
catch (Exception e) {
System.out.println("startDownloadServiceIfRequired error");
e.printStackTrace();
}
return startResult;
}
示例4: checkDownload
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());
}
示例5: call
@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;
}
示例6: onCreate
@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?
}
示例7: onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
// overridePendingTransition(R.anim.fragment_slide_left_enter,
// R.anim.fragment_slide_left_exit);
// Check if expansion files are available before going any further
if (!expansionFilesDelivered()) {
try {
Utilities.cleanUpOldData(getApplicationContext());
// Build an Intent to start this activity from the Notification
Intent notifierIntent = new Intent(this,
SplashActivity.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);
// Start the download service (if required)
int startResult = DownloaderClientMarshaller
.startDownloadServiceIfRequired(this, pendingIntent,
FieldGuideDownloaderService.class);
// If download has started, initialize this activity to show
// download progress
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
// Instantiate a member instance of IStub
// mDownloaderClientStub =
// DownloaderClientMarshaller.CreateStub(this,
// FieldGuideDownloaderService.class);
// Inflate layout that shows download progress
// setContentView(R.layout.downloader_ui);
/**
* Both downloading and validation make use of the
* "download" UI
*/
initializeDownloadUI();
return;
} // If the download wasn't necessary, fall through to start the
// app
} catch (NameNotFoundException e) {
Log.e(TAG, "Cannot find own package! MAYDAY!");
e.printStackTrace();
}
}
startApp();
}
示例8: onCreate
/**
* Called when the activity is first create; we wouldn't create a layout in
* the case where we have the file and are moving to another activity
* without downloading.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**
* Both downloading and validation make use of the "download" UI
*/
initializeDownloadUI();
/**
* Before we do anything, are the files we expect already here and
* delivered (presumably by Market) For free titles, this is probably
* worth doing. (so no Market request is necessary)
*/
if (!expansionFilesDelivered()) {
try {
Intent launchIntent = SampleDownloaderActivity.this
.getIntent();
Intent intentToLaunchThisActivityFromNotification = new Intent(
SampleDownloaderActivity
.this, SampleDownloaderActivity.this.getClass());
intentToLaunchThisActivityFromNotification.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentToLaunchThisActivityFromNotification.setAction(launchIntent.getAction());
if (launchIntent.getCategories() != null) {
for (String category : launchIntent.getCategories()) {
intentToLaunchThisActivityFromNotification.addCategory(category);
}
}
// Build PendingIntent used to open this activity from
// Notification
PendingIntent pendingIntent = PendingIntent.getActivity(
SampleDownloaderActivity.this,
0, intentToLaunchThisActivityFromNotification,
PendingIntent.FLAG_UPDATE_CURRENT);
// Request to start the download
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
pendingIntent, SampleDownloaderService.class);
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
// The DownloaderService has started downloading the files,
// show progress
initializeDownloadUI();
return;
} // otherwise, download not needed so we fall through to
// starting the movie
} catch (NameNotFoundException e) {
Log.e(LOG_TAG, "Cannot find own package! MAYDAY!");
e.printStackTrace();
}
} else {
validateXAPKZipFiles();
}
}