Android trial library을 작성했습니다. 프로젝트에 간단하게 추가 할 수 있으며 오프라인 서버가 있으면 모든 서버 측 관리 (오프라인 유예 기간 포함)를 처리하므로 자체 서버가 필요하지 않습니다.
단순히
는 메인 모듈의 build.gradle
dependencies {
compile 'io.trialy.library:trialy:1.0.2'
}
주요 활동의 onCreate()
방법에 라이브러리를 초기화
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Initialize the library and check the current trial status on every launch
Trialy mTrialy = new Trialy(mContext, "YOUR_TRIALY_APP_KEY");
mTrialy.checkTrial(TRIALY_SKU, mTrialyCallback);
}
추가로 라이브러리를 추가,이 기능을 사용하려면 콜백 핸들러 :
private TrialyCallback mTrialyCallback = new TrialyCallback() {
@Override
public void onResult(int status, long timeRemaining, String sku) {
switch (status){
case STATUS_TRIAL_JUST_STARTED:
//The trial has just started - enable the premium features for the user
break;
case STATUS_TRIAL_RUNNING:
//The trial is currently running - enable the premium features for the user
break;
case STATUS_TRIAL_JUST_ENDED:
//The trial has just ended - block access to the premium features
break;
case STATUS_TRIAL_NOT_YET_STARTED:
//The user hasn't requested a trial yet - no need to do anything
break;
case STATUS_TRIAL_OVER:
//The trial is over
break;
}
Log.i("TRIALY", "Trialy response: " + Trialy.getStatusMessage(status));
}
};
재판을 시작하려면, mTrialy.startTrial("YOUR_TRIAL_SKU", mTrialyCallback);
앱 키를 호출하고 시험 SKU는 Trialy developer dashboard에서 찾을 수 있습니다.
사용자는 실제로 재판에 대해 비용을 청구하지 않고 단순히 미래의 지불을 승인합니다. – X3Btel
알고 있습니다. 그러나 나는 그것을 원하지 않습니다. 마케팅 행동이 좋지 않다고 생각합니다. 시험 사용 기간이 끝난 후 사용자는 결제 대화 상자를 볼 수 있습니다. – Anonymous
Android 용 앱으로 개발자가 더 잘 작동합니다. 어쨌든 내가 원하지 않는 방식으로 작동하는 Google API가 있다고 생각하지 않습니다. 제안 된대로'SharedPreference' (hackable) 또는 자신의 서버에서 타임 스탬프를 사용할 수 있습니다. – X3Btel