Skip to content

Commit 352e6e5

Browse files
committed
feat(notifications): using action without package name
1 parent 94ee339 commit 352e6e5

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

AndroidSDK/src/com/leanplum/LeanplumPushReceiver.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ public void onReceive(Context context, Intent intent) {
5656
// Forward Intent to a client broadcast receiver.
5757
Intent forwardIntent = new Intent();
5858
// Add action to be able to differentiate between multiple intents.
59-
String action = Util.buildIntentAction(context,
60-
Constants.ClassUtil.LEANPLUM_NOTIFICATION);
61-
forwardIntent.setAction(action);
59+
forwardIntent.setAction(LeanplumPushService.LEANPLUM_NOTIFICATION);
6260
forwardIntent.setClassName(context, receiver);
6361
forwardIntent.putExtras(intent.getExtras());
6462
context.sendBroadcast(forwardIntent);

AndroidSDK/src/com/leanplum/LeanplumPushService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ public class LeanplumPushService {
7171
* Leanplum's built-in Google Cloud Messaging sender ID.
7272
*/
7373
public static final String LEANPLUM_SENDER_ID = "44059457771";
74-
74+
/**
75+
* Intent action used when broadcast is received in custom BroadcastReceiver.
76+
*/
77+
public static final String LEANPLUM_NOTIFICATION = "LP_NOTIFICATION";
7578
/**
7679
* Action param key contained when Notification Bundle is parsed with {@link
7780
* LeanplumPushService#parseNotificationBundle(Bundle)}.

AndroidSDK/src/com/leanplum/internal/Constants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,5 @@ public static class Messaging {
259259

260260
public static class ClassUtil {
261261
public static final String UI_INTERFACE_EDITOR = "com.leanplum.uieditor.LeanplumUIEditor";
262-
public static final String LEANPLUM_NOTIFICATION = "LP_NOTIFICATION";
263262
}
264263
}

AndroidSDK/src/com/leanplum/internal/LeanplumManifestHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import android.text.TextUtils;
2929

3030
import com.leanplum.Leanplum;
31+
import com.leanplum.LeanplumPushService;
3132

3233
import org.w3c.dom.Document;
3334
import org.w3c.dom.NamedNodeMap;
@@ -531,7 +532,7 @@ public static String parseNotificationMetadata() {
531532
ApplicationInfo app = context.getPackageManager().getApplicationInfo(context.getPackageName(),
532533
PackageManager.GET_META_DATA);
533534
Bundle bundle = app.metaData;
534-
return bundle.getString(Constants.ClassUtil.LEANPLUM_NOTIFICATION);
535+
return bundle.getString(LeanplumPushService.LEANPLUM_NOTIFICATION);
535536
} catch (Throwable ignored) {
536537
}
537538
return null;

AndroidSDK/src/com/leanplum/internal/Util.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -969,18 +969,4 @@ public static int generateIdFromResourceName(String resourceName) {
969969
Log.w("Could not extract resource id from provided resource name: ", resourceName);
970970
return 0;
971971
}
972-
973-
/**
974-
* Builds intent action in format PackageName + Action.
975-
*
976-
* @param context Surrounding context.
977-
* @param action Intent action.
978-
* @return Action in format com.example.Action.
979-
*/
980-
public static String buildIntentAction(Context context, String action) {
981-
if (context == null) {
982-
return null;
983-
}
984-
return context.getPackageName() + "." + action;
985-
}
986972
}

0 commit comments

Comments
 (0)