For security reasons, our server only supports HTTPS connection with a minimum TLS 1.2 protocol.
Android 4.1 – 4.4 phones support TLS 1.2 with the help of Google Play Services
Our SDK needs a Google Play Service to update security, Google has several dependencies that hinder the play-services-base code.
Example with Google Analytics dependency :
Use the method APMUIServicesUser.userClientConnect() for connect automatically your user to app’s miles.If no account exist with this informations, the server create automatically this account.
This method needs : « email », « userID » and « optIn »
– « email » is the email of user– « userID » is a unique identifier in your database
– « optIn » is the RGPD OptIn
If you don’t want pass the email, you can build a encrypted email with the userID, for example : 123456789@appsmiles.fr
– 123456789 is the userID
You can pass a segmentation during connection with the method APMUIServicesUser.userClientConnect()
//Segments
HashMap segments = new HashMap();
segments.put("1", "green"); //Axe 1 : color
segments.put("2", "1998"); //Axe 2 : year
APMUIServicesUser.userClientConnect(/*....*/, segments, /*....*/)
Override click on the badge
You can override the click on the badge with the method APMBadgeManager.setOnBadgeClickListener()
APMBadgeManager badgeManager = APMPublic.sharedInstanceBadgeManagerPrivate();
badgeManager.setOnBadgeClickListener(new APMOnBadgeClickListener()
{
@Override
public boolean onBadgeClick(int badge)
{
if(badge == APMConfig.APM_BADGE_INIT)
Log.d("APMOnBadgeClickListener", "Click on the badge init !");
else if(badge == APMConfig.APM_BADGE_OTHER_WIN)
Log.d("APMOnBadgeClickListener", "Click on the badge other win !");
else if(badge == APMConfig.APM_BADGE_WIN)
Log.d("APMOnBadgeClickListener", "Click on the badge win !");
else if(badge == APMConfig.APM_BADGE_GIFT)
Log.d("APMOnBadgeClickListener", "Click on the badge gift !");
else if(badge == APMConfig.APM_BADGE_INFOS)
Log.d("APMOnBadgeClickListener", "Click on the badge infos !");
else if(badge == APMConfig.APM_BADGE_ADMIN)
Log.d("APMOnBadgeClickListener", "Click on the badge admin !");
return true;
}
});
Comment : Return true if the event was handled, false otherwise.
Show/Hide badge
You can hide the badge with the method :
APMPublic.sharedInstance(this).hideBadge();
And show the badge :
APMPublic.sharedInstance(this).showBadge();
Comment : The method APMUIServicesUser.userClientConnect() use theses methods to hide and show the badge after connection success.
Debug Mode
APMPublic.sharedInstance(this).setDebugMode(true); //To show trace log app's miles
Onboarding (get events with listener)
For retrieve events of onboarding. Use class APMOnboardingUtils and APMOnboardingUtilsListener.
Example with AbstractActivity lifecycle.
public class AbstractActivity extends FragmentActivity implements APMOnboardingUtilsListener
{
//...
//Declare a object of APMOnboardingUtils in your class
private APMOnboardingUtils mOnboardingUtils;
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//...
//AbstractActivity become the listener on events of onboarding
mOnboardingUtils = new APMOnboardingUtils(this);
}
@Override
protected void onResume()
{
super.onResume();
//...
//Listen events of onboarding
mOnboardingUtils.register(this);
}
@Override
protected void onPause()
{
super.onPause();
//...
//Unlisten events of onboarding
mOnboardingUtils.unregister(this);
}
@Override
public void apmOnboardingButtonOkClicked()
{
//Get the event OnboardingButtonOkClicked
}
@Override
public void apmOnboardingButtonLaterClicked()
{
//Get the event OnboardingButtonLaterClicked
}
@Override
public void apmOnboardingButtonNeverClicked()
{
//Get the event OnboardingButtonNeverClicked
}
}
DeepLinks (get events with listener)
For retrieve events of deepLinks. Use class APMDeepLinkActionUtils and APMDeepLinkActionUtilsListener.
Example with AbstractActivity lifecycle.
public class AbstractActivity extends FragmentActivity implements APMDeepLinkActionUtilsListener
{
//...
//Declare a object of APMDeepLinkActionUtils in your class
private APMDeepLinkActionUtils mDeepLinkActionUtils;
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//...
//Activity become the listener on events of deepLinks
mDeepLinkActionUtils = new APMDeepLinkActionUtils(this);
}
@Override
protected void onResume()
{
super.onResume();
//...
//Listen events of deepLinks
mDeepLinkActionUtils.register(this);
}
@Override
protected void onPause()
{
super.onPause();
//...
//Unlisten events of deepLinks
mDeepLinkActionUtils.unregister(this);
}
@Override
public void apmDeepLinkActionButtonGoClicked(String deepLinkUrl, String action, HashMap params)
{
//Get the event DeepLinkActionButtonGoClicked
}
}
APMServicesUserListener
You can be notify when the user changed with the class APMServicesUserListener
Set a listener with
execute("appsmilessdk://addActions/{"classID":"product", "actions":[{"labels":["Clic sur un produit", "Clic sur un produit de la catégorie Google", "Clic sur le produit GOOGLE !"], "props":["click_product", "categoryID=1", "productID=1"]}]}");
triggerAction(Android) == triggerAction(JS)
Call triggerAction appsmilessdk://triggerAction/+ACTION_NAME in your webview to call triggerActionin AndroidACTION_NAME is a String