Skip to content

Commit 64faa07

Browse files
authored
Merge pull request #65 from pozirk/master
v3.0.1: Updated to work with the latest OpenFL 9.4.2 and Lime 8.2.3
2 parents 7144217 + c40e256 commit 64faa07

File tree

6 files changed

+238
-182
lines changed

6 files changed

+238
-182
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: |
4141
haxelib run lime config ANDROID_SDK $ANDROID_HOME
4242
haxelib run lime config ANDROID_NDK_ROOT $ANDROID_NDK_LATEST_HOME
43-
haxelib run lime config JAVA_HOME $JAVA_HOME_11_arm64
43+
haxelib run lime config JAVA_HOME $JAVA_HOME_17_arm64
4444
haxelib run lime config ANDROID_SETUP true
4545
4646
- name: Build

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,25 @@ To configure **extension-admob** for your project, follow these steps:
3535
chmod +x setup_admob_ios.sh && ./setup_admob_ios.sh
3636
```
3737

38-
2. **Add AdMob App IDs**
38+
2. **Update SKAdNetworkItems**
39+
You need to make sure that the lsit of **SKAdNetworkItems** is up-to-date.
40+
Go to https://developers.google.com/admob/ios/privacy/strategies to copy and replace the current list here:
41+
*extension-admob/X,X,X/templates/ios/template/{{app.file}}/admob-Info.plist*
42+
43+
3. **Add AdMob App IDs**
3944
Include your AdMob app IDs in your **project.xml**. Ensure you specify the correct IDs for both Android and iOS platforms.
4045
```xml
4146
<setenv name="ADMOB_APPID" value="ca-app-pub-XXXXX123457" if="android"/>
4247
<setenv name="ADMOB_APPID" value="ca-app-pub-XXXXX123458" if="ios"/>
4348
```
44-
45-
3. **GDPR Consent Management**
49+
50+
4. **GDPR Consent Management**
4651
Beginning January 16, 2024, Google requires publishers serving ads in the EEA and UK to use a certified consent management platform (CMP). This extension integrates Google's UMP SDK to display a consent dialog during the first app launch. Ads may not function if user does not provide consent.
52+
53+
54+
### Usage
4755

48-
3. **Initializing Admob extension**
56+
1. **Initializing Admob extension**
4957
If GDPR consent dialog and/or iOS 14+ tracking authorization dialog are required, they are shown automatically upon Admob initialization.
5058
```haxe
5159
import extension.admob.*;
@@ -58,7 +66,7 @@ To configure **extension-admob** for your project, follow these steps:
5866
Admob.init();
5967
```
6068

61-
4. **Checking GDPR Consent Requirements**
69+
2. **Checking GDPR Consent Requirements**
6270
After consenting (or not) to show ads, user must have an option to change his choice.
6371
To give this choice an access to GDPR consent dialog should be provided somewhere in the app.
6472
You can determine if the GDPR consent dialog is required (ie user is from EEA or UK):
@@ -67,13 +75,13 @@ To configure **extension-admob** for your project, follow these steps:
6775
trace("GDPR consent dialog is required.");
6876
```
6977

70-
5. **Reopen Privacy Options Dialog**
78+
3. **Reopening Privacy Options Dialog**
7179
If needed, allow users to manage their GDPR consent options again:
7280
```haxe
7381
Admob.showPrivacyOptionsForm();
7482
```
7583

76-
6. **Verify User Consent**
84+
4. **Verifing User Consent**
7785
Check if user has consented to personalized ads:
7886
```haxe
7987
if (Admob.getConsent() == AdmobConsent.FULL)
@@ -82,7 +90,7 @@ To configure **extension-admob** for your project, follow these steps:
8290
trace("User did not consent to personalized ads.");
8391
```
8492

85-
7. **Check Consent for Specific Purposes**
93+
5. **Checking Consent for Specific Purposes**
8694
Verify if user has consented to individual purposes, such as purpose 0:
8795
```haxe
8896
if (Admob.hasConsentForPurpose(0) == 1)
@@ -91,7 +99,7 @@ To configure **extension-admob** for your project, follow these steps:
9199
trace("User has not consented to purpose 0.");
92100
```
93101

94-
9. **Load and Show Ads**
102+
6. **Loading and Showing Ads**
95103
Add the following snippets to display ads in your app:
96104

97105
- **Banner Ad**

examples/admobtest/project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717

1818
<haxeflag name="-dce" value="full" />
1919

20-
<config:android target-sdk-version="34" />
20+
<config:android minimum-sdk-version="23" target-sdk-version="36" gradle-version="8.11.1" gradle-plugin="8.9.1"/>
2121
</project>

project/admob-ios/src/admob.mm

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static void initMobileAds(bool testingAds, bool childDirected, bool enableRDP)
366366
{
367367
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status)
368368
{
369-
if (_admobCallback)
369+
/*if (_admobCallback)
370370
{
371371
switch (status)
372372
{
@@ -383,12 +383,30 @@ static void initMobileAds(bool testingAds, bool childDirected, bool enableRDP)
383383
_admobCallback("ATT_STATUS", "AUTHORIZED");
384384
break;
385385
}
386-
}
386+
}*/
387387

388-
[[GADMobileAds sharedInstance] startWithCompletionHandler:^(GADInitializationStatus *status)
388+
[[GADMobileAds sharedInstance] startWithCompletionHandler:^(GADInitializationStatus *status2)
389389
{
390390
if (_admobCallback)
391+
{
392+
switch (status)
393+
{
394+
case ATTrackingManagerAuthorizationStatusNotDetermined:
395+
_admobCallback("ATT_STATUS", "NOT_DETERMINED");
396+
break;
397+
case ATTrackingManagerAuthorizationStatusRestricted:
398+
_admobCallback("ATT_STATUS", "RESTRICTED");
399+
break;
400+
case ATTrackingManagerAuthorizationStatusDenied:
401+
_admobCallback("ATT_STATUS", "DENIED");
402+
break;
403+
case ATTrackingManagerAuthorizationStatusAuthorized:
404+
_admobCallback("ATT_STATUS", "AUTHORIZED");
405+
break;
406+
}
407+
391408
_admobCallback("INIT_OK", _message);
409+
}
392410
}];
393411
}];
394412
}

templates/ios/template/{{app.file}}.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@
402402
"\"$(SRCROOT)/::APP_FILE::/lib/x86_64\"",
403403
);
404404
OTHER_LDFLAGS = (
405+
"-lmbedtls_hxcpp",
405406
::foreach ndlls:: "-l::name::",
406407
::end::
407408
::foreach linkedLibraries:: "-l::__current__::",
@@ -456,6 +457,7 @@
456457
"\"$(SRCROOT)/::APP_FILE::/lib/x86_64\"",
457458
);
458459
OTHER_LDFLAGS = (
460+
"-lmbedtls_hxcpp",
459461
::foreach ndlls:: "-l::name::",
460462
::end::
461463
::foreach linkedLibraries:: "-l::__current__::",

0 commit comments

Comments
 (0)