DRM - App Tester - GameMaker:Studio

Hello Amazon Devs

I’m creating an Amazon DRM extension for GameMaker:Studio and eventually IAPs and other features.

The problem at the moment it’s that when I got into debug mode after call:

adb shell setprop debug.amazon.sandboxmode debug

I stop getting callbacks, just never got triggered

but if I close the app and call:

adb shell setprop debug.amazon.sandboxmode noone

Open the app I got the callbacks again… any idea?

more information:

First I called:

adb kill-server
adb start-server
adb devices

This is the code that I’m using:

public void amazon_verify_license()
{
	Log.i("yoyo","amazon_verify_license");
	try{
		
		RunnerActivity.ViewHandler.post(new Runnable() {
			public void run() {
				Toast.makeText(activity, "amazon_verify_license!", Toast.LENGTH_LONG).show();
			}
		});
		
		LicensingService.verifyLicense(activity, this);
		
		RunnerActivity.ViewHandler.post(new Runnable() {
			public void run() {
				Toast.makeText(activity, "amazon_verify_license POST!", Toast.LENGTH_LONG).show();
			}
		});
		
		
	int dsMapIndex = RunnerJNILib.jCreateDsMap(null, null, null);
	RunnerJNILib.DsMapAddString(dsMapIndex, "type", "TEST");
	RunnerJNILib.CreateAsynEventWithDSMap(dsMapIndex, EVENT_OTHER_SOCIAL);
		
	}catch(Exception e)
	{
		RunnerActivity.ViewHandler.post(new Runnable() {
			public void run() {
				Toast.makeText(activity, e.getMessage(), Toast.LENGTH_LONG).show();
			}
		});
	}
}
///////////////////////////////LicensingListener

@Override
public void onLicenseCommandResponse(LicenseResponse licenseResponse) {
	
	Log.i("yoyo", "onLicenseCommandResponse");
	
	final RequestStatus status = licenseResponse.■■■■■■■■■■■■■■■■();
	
	int dsMapIndex = RunnerJNILib.jCreateDsMap(null, null, null);
	RunnerJNILib.DsMapAddString(dsMapIndex, "type", "amazon_verify_license");

	Log.i("yoyo", "onLicenseCommandResponse: RequestStatus (" + status + ")");
    switch (status) {
        case LICENSED:
            Log.i("yoyo", "LicenseResponse status: " + status);
			RunnerJNILib.DsMapAddString(dsMapIndex, "status", "LICENSED");
            break;
        case NOT_LICENSED:
            Log.i("yoyo", "LicenseResponse status: " + status);
			RunnerJNILib.DsMapAddString(dsMapIndex, "status", "NOT_LICENSED");
        case EXPIRED:
            Log.i("yoyo", "LicenseResponse status: " + status);
            break;
        case ERROR_VERIFICATION:
            Log.i("yoyo", "LicenseResponse status: " + status);
			RunnerJNILib.DsMapAddString(dsMapIndex, "status", "ERROR_VERIFICATION");
        case ERROR_INVALID_LICENSING_KEYS:
            Log.i("yoyo", "LicenseResponse status: " + status);
			RunnerJNILib.DsMapAddString(dsMapIndex, "status", "ERROR_INVALID_LICENSING_KEYS");
			break;
		// case EXPIRED:
			// RunnerJNILib.DsMapAddString(dsMapIndex, "status", "EXPIRED");
			// break;
        case UNKNOWN_ERROR:
            Log.i("yoyo", "LicenseResponse status: " + status);
			RunnerJNILib.DsMapAddString(dsMapIndex, "status", "UNKNOWN_ERROR");
			break;
		default:
			RunnerJNILib.DsMapAddString(dsMapIndex, "status", "OTHER");
			break;
    }
	
	RunnerJNILib.CreateAsynEventWithDSMap(dsMapIndex, EVENT_OTHER_SOCIAL);
}

I added this implementation:
implementation ‘com.amazon.device:amazon-appstore-sdk:3.+’

and this receiver:

<receiver android:name = "com.amazon.device.drm.ResponseReceiver" android:exported="true" 
          android:permission = "com.amazon.drm.Permission.NOTIFY" >
    <intent-filter>
        <action android:name = "com.amazon.drm.NOTIFY" />
    </intent-filter>
</receiver>

I’m using The Amazon HD 7, I tested the SamleDRMApp project and it’s working correctly (even I can change the response), app tester it’s installed, AppstoreAuthenticationKey.pem and amazon.sdktester.json in place where should be.

Any idea?

Hope someone can help me

I can bring any additional information.

Regards

Hi there,

Thanks for posting! Could it be that your code is obfuscated or that ProGuard is missing some rules related to IAP? That’s a common reason for callbacks not getting triggered, please see this article: Obfuscate The App Code | In-App Purchasing

@Levon thanks for reply

But if that it’s the case should be the same sandbox mode it’s on debug or noone

adb shell setprop debug.amazon.sandboxmode debug
adb shell setprop debug.amazon.sandboxmode noone

because the callback work on noone but not on debug. and the proguard it’s the same for both cases.

I will give a try but not sure that it’s the issue.

I will post the results.

Regards

I already inserted this code in the proguard and nothing exactly same issue…:

-dontwarn com.amazon.**
-keep class com.amazon.** {*;}
-keepattributes *Annotation*

I forgot mention that I’m using the debug APK as should be

More ideas?

@Levon Just to be totally sure I commented out all the proguard related lines in the gradle. but the problem persists.
Any idea?

Thanks for all additional information. I asked the relevant team to look into it.

I hope they know how fix it :pray:

Hi @Levon, news about this topic? I can share the APK or simplified source with the team if it’s necessary to move fast in this topic.

Regards

@jzavala

I can confirm a similar issue, which I’m currently discussing on How to handle IAP subscription - #11 by Moses (scroll down to the newer comments)

I’m almost done creating the Game Maker extension, but cannot properly test it through Amazon’s App Tester.

The following simply does not work - as I can see the verbose logs of the Appstore SDK is in Release mode.

adb shell setprop debug.amazon.sandboxmode debug

Waiting for a reply on the post for now. Did you manage the solve that?

I can use command adb shell setprop debug.amazon.sandboxmode debug
on the use a APK build from the demo of Android Studio that they provide, but not using a APK from GameMaker, when I use the command I stop getting callbacks

Please @Levon add some priority to this investigation. I’m available to help solving this issue.

@Moses Including you as you are on a related topic.

Regards

Any updates? :grinning:

Could you be able to fix the issues? Hope to get some help from Amazon staff about this.

No updates from Amazon support yet.

@Levon Any kind of update will be welcome.

Hello,

While this is still being investigated, could you please double check your Gradle config, and also check with the GameMaker support team to see if there’s anything special / different in how the APK is being built? As I mentioned earlier, the most common reason for not getting callbacks, is IAP related methods in com.amazon.* being removed during the build process. Thanks!

Hello @Levon

-Gradle config still same as I published previously.

-I’m not testing IAPs yet.

-I’m not getting callbacks on the DRM callback onLicenseCommandResponse calling LicensingService.verifyLicense(activity, this); function when I use the debug APK, if I use release APK I’m getting callback but I can’t test with AppTester with the release APK it’s documented.

-I have direct contact with GameMaker team and this looks more be an issue in the amazon-appstore-sdk than in GameMaker.

-I already removed all proguard related code to confirm that isn’t the issue and can’t be the issue due callback works release mode, and on debug mode if db shell setprop debug.amazon.sandboxmode noone but I don’t get callback if db shell setprop debug.amazon.sandboxmode debug. this make me think that the issue it’s on the amazon-appstore-sdk side.

I can send you a minimized project to build the APKs and test the issue, or just send the APKs if help to move forward.

Regards

@jzavala

I have found the solution with a small hackaround and it’s not appstore-sdk related :sweat_smile:

I can completely confirm that I can test my IAP implementation on my Game Maker project with App Tester.

I also have a good news for you, because the solution has already been implemented (it coincides with my Crashlytics NDK implementation, see the issue here : Add injector for Android ProjectFiles > buildTypes > release · Issue #7311 · YoYoGames/GameMaker-Bugs · GitHub).

You just need to add the following to the extension through the YYAndroidBuildTypesRelease tag. (I think you may need to use an internal GM version, we don’t have it yet.)

<YYAndroidBuildTypesRelease>
debuggable true
</YYAndroidBuildTypesRelease>

Or through editing the GM runtime in \android\runner\ProjectFiles\build.gradle (How I can do it for now)

buildTypes {
        release {
            debuggable true // << Here
			signingConfig signingConfigs.release
			minifyEnabled ${YYAndroidProGuardMinifyEnabled}
			shrinkResources ${YYAndroidProGuardShrinkResources}
			getIsDefault().set(true)
			ndk {
                debugSymbolLevel 'FULL'
            }
			proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
			consumerProguardFiles 'proguard-rules.pro'
        }
    }

I’m happy to share more if needed.

1 Like

@foxview Thanks for your contribution but doesn’t fix the issue with DRM, I will having the same issue that I reported but now I dont need install manually the debug APK due now the direct APK now it’s debuggable

@Levon Problem persists even with the contribution of
@foxview

Regards

@jzavala Just implemented DRM API and I can test it with App Tester and I correctly get callbacks for it.

Did you include this in the extension?

<YYAndroidManifestManifestInject>
  <queries>
    <package android:name="com.amazon.sdktestclient" />
    <package android:name="com.amazon.venezia" />
<intent>
        <action android:name="*" />
    </intent>
  </queries>
</YYAndroidManifestManifestInject>
1 Like

@foxview That make it work!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.