Android Question Play Pass Program - Error with followLastLicensingURL

Jack Cole

Well-Known Member
Licensed User
Longtime User
I have 2 apps in the Google Play Pass program (subscription program by Google where users can get access to a catalog of apps for a monthly fee). In order to participate, I had to modify the licensing library to bring up an app store wall if their subscription has expired. All was well and good until I started targeting API level 28 instead of 27. When the app tries to run the code for lc.followLastLicensingURL, I get a crash with the following error.


The code that I am having trouble with is the following:

B4X:
Sub lc_DontAllow (PolicyReason As Int)
    StateManager.SetSetting("licensed",False)
    StateManager.SaveSettings
    If Not(PolicyReason=lc.POLICY_RETRY) Then
        lc.followLastLicensingURL
        ExitApplication
    End If
End Sub

On the JAVA side, I have the following code.

B4X:
    public void followLastLicensingURL() {
        lc.followLastLicensingUrl(BA.applicationContext);
        // Call finish() on the surrounding activity to remove it from the backstack.
        //MainActivity.this.finish();
    }

Any ideas about what to try to make JAVA happy?
 

Jack Cole

Well-Known Member
Licensed User
Longtime User
I think I have been able to solve this on my own. The I used some newer code for the licensing library for the followLastLicensingURL function.

Java:
    public void followLastLicensingUrl(Context context) {
        String licensingUrl = mPolicy.getLicensingUrl();
        if (licensingUrl == null) {
            licensingUrl = "https://play.google.com/store/apps/details?id=" + context.getPackageName();
        }
        Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(licensingUrl));
        marketIntent.setPackage("com.android.vending");
        if (!(context instanceof Activity)) {
            marketIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
        context.startActivity(marketIntent);
    }
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…