Skip to content

Commit 742781c

Browse files
committed
Add device_type to sendReceiveReceipt
- get deviceType from `OSUtils.getDeviceType()`
1 parent 09b8d91 commit 742781c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSReceiveReceiptController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ synchronized public static OSReceiveReceiptController getInstance() {
5454
void sendReceiveReceipt(final CallbackToFutureAdapter.Completer<ListenableWorker.Result> callbackCompleter, @NonNull final String notificationId) {
5555
final String appId = OneSignal.appId == null || OneSignal.appId.isEmpty() ? OneSignal.getSavedAppId() : OneSignal.appId;
5656
final String playerId = OneSignal.getUserId();
57+
final int deviceType = new OSUtils().getDeviceType();
5758

5859
if (!remoteParamController.isReceiveReceiptEnabled()) {
5960
OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "sendReceiveReceipt disable");
@@ -64,7 +65,7 @@ void sendReceiveReceipt(final CallbackToFutureAdapter.Completer<ListenableWorker
6465
Runnable receiveReceiptRunnable = new Runnable() {
6566
@Override
6667
public void run() {
67-
repository.sendReceiveReceipt(appId, playerId, notificationId, new OneSignalRestClient.ResponseHandler() {
68+
repository.sendReceiveReceipt(appId, playerId, deviceType, notificationId, new OneSignalRestClient.ResponseHandler() {
6869
@Override
6970
void onSuccess(String response) {
7071
OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "Receive receipt sent for notificationID: " + notificationId);

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSReceiveReceiptRepository.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ class OSReceiveReceiptRepository {
3636

3737
private static final String APP_ID = "app_id";
3838
private static final String PLAYER_ID = "player_id";
39+
private static final String DEVICE_TYPE = "device_type";
3940

40-
void sendReceiveReceipt(@NonNull String appId, @NonNull String playerId, @NonNull String notificationId, @NonNull OneSignalRestClient.ResponseHandler responseHandler) {
41+
void sendReceiveReceipt(@NonNull String appId, @NonNull String playerId, @NonNull int deviceType, @NonNull String notificationId, @NonNull OneSignalRestClient.ResponseHandler responseHandler) {
4142
try {
4243
JSONObject jsonBody = new JSONObject()
4344
.put(APP_ID, appId)
44-
.put(PLAYER_ID, playerId);
45+
.put(PLAYER_ID, playerId)
46+
.put(DEVICE_TYPE, deviceType);
4547

4648
OneSignalRestClient.put("notifications/" + notificationId + "/report_received", jsonBody, responseHandler);
4749
} catch (JSONException e) {

0 commit comments

Comments
 (0)