Migration 1.48. to 2.0.
Migration from 1.48. to 2.0.
There were no functional changes. Calling remain the same. All static functions in Platform101xp remained the same.
changes in gradle.build
compileSdk and buildToolsVersion minimal version rise to 33 and 33.0.0
compileSdk 33
buildToolsVersion '33.0.0'
minSdkVersion minimal version rise to 21
minSdkVersion 21
changes in dependicaes
from
implementation 'com.platform101xp:platform101xp-sdk:X.XX.X'
to
implementation 'com.platform101xp:sdk:2.XX.XX'
implementation 'com.platform101xp:advertising:2.XX.XX'
implementation 'com.platform101xp:api:2.XX.XX'
implementation 'com.platform101xp:authorization:2.XX.XX'
implementation 'com.platform101xp:base:2.XX.XX'
implementation 'com.platform101xp:billing:2.XX.XX'
implementation 'com.platform101xp:utils:2.XX.XX'
changes in class path
- Platform101XPPurchase from
import com.platform101xp.sdk.Platform101XPPurchase;
to
import com.platform101xp.billing.dto.Platform101XPPurchase;
- Platform101XPProduct from
import com.platform101xp.sdk.Platform101XPProduct;
to
import com.platform101xp.billing.dto.Platform101XPProduct;
- Platform101XPError from
import com.platform101xp.sdk.Platform101XPError;
to
import com.platform101xp.base.error.Platform101XPError;
- Platform101XPError.ErrorType and change name to BaseErrorType from
import com.platform101xp.sdk.Platform101XPError;
to
import com.platform101xp.base.error.BaseErrorType;
- Platform101XPSNType from
import com.platform101xp.sdk.Platform101XPSNType;
to
import com.platform101xp.authorize.social_networks.utils.Platform101XPSNType;
- Platform101XPToken from
import com.platform101xp.sdk.Platform101XPToken;
to
import com.platform101xp.authorize.token.Platform101XPToken;
- Platform101XPSocialFriend from
import com.platform101xp.sdk.entities.Platform101XPSocialFriend;
to
import com.platform101xp.authorize.social_networks.entities.Platform101XPSocialFriend;
- Platform101XPAccount to Account from
import com.platform101xp.sdk.internal.Platform101XPAccount;
to
import com.platform101xp.authorize.account.Account;
changes in call static func from Platform101XP
all code in sdk move to Kotlin, and static func from java call through Companion
Example:
old
Platform101XP.authorize();
Platform101XP.showProfile();
new
Platform101XP.Companion.authorize();
Platform101XP.Companion.showProfile();
just use Platform101XP.Companion for call func.
If your application use Kotlin, just call
Platform101XP.authorize()
Platform101XP.showProfile()
changes in interface Platform101XPListener
add new func in Platform101XPListener
void onPurchaseProductInternalOrderResult(String productId, Platform101XPBillingConfig.InternalOrderStatus status, Platform101XPError error);
void onCheckMobilePurchase(String itemName, boolean bought, Platform101XPError error);
void onGetAccountResult(Account account, Platform101XPError error);
For import
import com.platform101xp.billing.internal.InternalOrderStatus;
import com.platform101xp.authorize.account.Account;
new functions in Platform101XPListener
void onPurchaseProductInternalOrderResult(String productId, Platform101XPBillingConfig.InternalOrderStatus status, Platform101XPError error){
if (error != null) {
showMessage("Error onPurchaseProductInternalOrderResult: " + error.toString());
} else {
if (status == Platform101XPBillingConfig.InternalOrderStatus.PAYED) {
//reward user, complete purchase
Log.d(Platform101XP.LOG_TAG, "onPurchaseProductInternalOrderResult COMPLETED");
} else {
Log.d(Platform101XP.LOG_TAG, "onPurchaseProductInternalOrderResult productId:" + productId + " status:"+status.name());
}
}
}
@Override
public void onCheckMobilePurchase(String itemName, boolean bought, Platform101XPError error) {
if (error != null) {
// Handle an error
if (error.getErrorType() == Platform101XPError.ErrorType.ERROR_NOT_AUTHORIZED)
Platform101XP.authorize();
} else {
// Web Store result check bought param
}
}
@Override
public void onGetAccountResult(Account account, Platform101XPError error) {
if (error==null && account != null) {
}
}
remove functions
void onRewardedAdLoaded();
void onRewardedAdShowed(int amount, String name, Platform101XPError error);
void onOfferwallAdLoaded();
void onOfferwallAdCredits(Map<String, String> creditInfo, Platform101XPError error);
manifest change for Facebook
For Facebook in manifest need add
<meta-data
android:name="com.facebook.sdk.ClientToken"
android:value="$your_facebook_client_token"/>
Please, ask your manager for Facebook ClientToken
manifest change for Robokassa
For Robokassa in manifest add in application level
<activity
android:name="com.platform101xp.billing.internal.robokassa.RobokassaBillingActivity"
android:exported="true" />
manifest&build.gradle change for Yookassa
For Yookassa in manifest in YourMainActivity inside <intent-filter> need add
<data android:scheme="mobilesdkxp"/>
//example
<activity
android:name="YourMainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
...
...
<data android:scheme="mobilesdkxp"/>
</intent-filter>
</activity>
And add in your build.gradle(application level)
android {
...
defaultConfig {
...
resValue "string", "ym_app_scheme", "mobilesdkxp"
}
}
gradle-wrapper & gradle-plugin up version
If your application contains kotlin gradle plugin please set his version >= 1.8.* gradle-wrapper up with '7.0.2' to '7.3.3'
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
Gadle Plugin up with '7.0.4' to '7.2.2' and Kotlin Plugin with '1.6.*' to '1.8.*'
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21"
...
}
}
if you build error write
Dublicate class kotlin.*.jdk8.* found in modules jetified-kotlin-stdlib-
just add in dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21"