From c222198a2c8c24a9e27507bb4f4462644626a347 Mon Sep 17 00:00:00 2001
From: Scott Rowe
- - UpdateRecommendationsService.java -
public class UpdateRecommendationsService extends IntentService {
private static final String TAG = "UpdateRecommendationsService";
@@ -136,10 +131,6 @@ public class UpdateRecommendationsService extends IntentService {
app manifest. The following code snippet illustrates how to declare this class as a service:
-
<manifest ... >
<application ... >
@@ -160,6 +151,11 @@ the recommendations to appear at the end of the recommendations row. Once a cont
movie, has been played,
remove it from the recommendations.
+The order of an app's recommendations is preserved according to the order in which the app
+provides them. The framework interleaves app recommendations based on recommendation quality,
+as measured by user behavior. Better recommendations make an app's recommendations more likely
+to appear near the front of the list.
+
Build Recommendations
@@ -175,10 +171,6 @@ remove it from the recommendations.
the builder pattern described as follows. First, you set the values of the recommendation card
elements.
-
-
- RecommendationBuilder.java
-
public class RecommendationBuilder {
...
@@ -221,13 +213,9 @@ public class RecommendationBuilder {
- The following code example demonstrates how to build a recommendation, and post it to the manager.
+ The following code example demonstrates how to build a recommendation.
-
-
- RecommendationBuilder.java
-
public class RecommendationBuilder {
...
@@ -250,8 +238,6 @@ public class RecommendationBuilder {
.setExtras(extras))
.build();
- mNotificationManager.notify(mId, notification);
- mNotificationManager = null;
return notification;
}
}
@@ -267,10 +253,6 @@ public class RecommendationBuilder {
every half hour:
-
public class BootupActivity extends BroadcastReceiver {
private static final String TAG = "BootupActivity";
@@ -307,10 +289,6 @@ public class BootupActivity extends BroadcastReceiver {
following sample code demonstrates how to add this configuration to the manifest:
-
<manifest ... >
<application ... >
@@ -330,3 +308,12 @@ public class BootupActivity extends BroadcastReceiver {
requests the {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission.
For more information, see {@link android.content.Intent#ACTION_BOOT_COMPLETED}.
+
+In your recommendation service class' {@link android.app.IntentService#onHandleIntent(android.content.Intent)
+onHandleIntent()}
+method, post the recommendation to the manager as follows:
+
+
+Notification notification = notificationBuilder.build();
+mNotificationManager.notify(id, notification);
+