File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed
onesignal/src/main/java/com/onesignal
unittest/src/test/java/com/test/onesignal Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -433,14 +433,6 @@ static OSInAppMessageController getInAppMessageController() {
433
433
@ Nullable private static OSNotificationDataController notificationDataController ;
434
434
435
435
@ Nullable private static AdvertisingIdentifierProvider adIdProvider ;
436
- private static synchronized @ Nullable AdvertisingIdentifierProvider getAdIdProvider () {
437
- if (adIdProvider == null ) {
438
- if (OSUtils .isAndroidDeviceType ())
439
- adIdProvider = new AdvertisingIdProviderGPS ();
440
- }
441
-
442
- return adIdProvider ;
443
- }
444
436
445
437
@ SuppressWarnings ("WeakerAccess" )
446
438
public static String sdkType = "native" ;
@@ -1422,11 +1414,6 @@ private static void registerUserTask() throws JSONException {
1422
1414
1423
1415
deviceInfo .put ("app_id" , getSavedAppId ());
1424
1416
1425
- if (getAdIdProvider () != null ) {
1426
- String adId = getAdIdProvider ().getIdentifier (appContext );
1427
- if (adId != null )
1428
- deviceInfo .put ("ad_id" , adId );
1429
- }
1430
1417
deviceInfo .put ("device_os" , Build .VERSION .RELEASE );
1431
1418
deviceInfo .put ("timezone" , getTimeZoneOffset ());
1432
1419
deviceInfo .put ("timezone_id" , getTimeZoneId ());
Original file line number Diff line number Diff line change @@ -314,6 +314,23 @@ public void testDeviceTypeIsAndroid_forPlayerCreate() throws Exception {
314
314
assertAndroidPlayerCreateAtIndex (1 );
315
315
}
316
316
317
+ @ Test
318
+ public void testAndroidDoesNotGetAdId () throws Exception {
319
+ // 2. Init OneSignal so the app id is cached
320
+ OneSignalInit ();
321
+ threadAndTaskWait ();
322
+
323
+ // 3. Make sure device_type is Amazon (2) in player create
324
+ assertAndroidPlayerCreateAtIndex (1 );
325
+
326
+ // 4. Assert Player Create does NOT have an ad_id
327
+ ShadowOneSignalRestClient .Request request = ShadowOneSignalRestClient .requests .get (1 );
328
+ JsonAsserts .doesNotContainKeys (request .payload , new ArrayList <String >() {{ add ("ad_id" ); }});
329
+
330
+ // 5. Assert we did NOT try to get a Google Ad id
331
+ assertFalse (ShadowAdvertisingIdProviderGPS .calledGetIdentifier );
332
+ }
333
+
317
334
@ Test
318
335
public void testDeviceTypeIsAmazon_forPlayerCreate () throws Exception {
319
336
// 1. Mock Amazon device type for this test
You can’t perform that action at this time.
0 commit comments