Trouble with licence check library - android

I am having trouble implementing Licensing using the licensing lib. My code alway seems to go to the "check network access" part or the "don't allow" part. I am testing using the method mentioned in the Setting Up for Licensing article (http://developer.android.com/google/play/licensing/setting-up.html). I have the licencing bits of my code below, let me know if you need to see anything else.
Note: most of this code is from the sample app that comes with the library.
public class Reminder_list extends ListActivity {
Global variables ....
private static final String BASE64_PUBLIC_KEY = "bla,bla,bla";
// Generate your own 20 random bytes, and put them here.
private static final byte[] SALT = new byte[] {
-46, 65, 30, -118, -103, -57, 74, -14, 51, 88, -95, -45, 77, -17, -36, -113, -11, 32, -64,
19
};
private LicenseCheckerCallback mLicenseCheckerCallback;
private LicenseChecker mChecker;
// A handler on the UI thread.
private Handler mHandler;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHandler = new Handler();
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
// LicencingLibrary calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
mChecker = new LicenseChecker(
this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
...
the rest of the stuff in the onCreate.
...
}
// this dialog is for the licence check.
protected Dialog onCreateDialog(int id) {
final boolean bRetry = id == 1;
return new AlertDialog.Builder(this)
.setTitle(R.string.unlicensed_dialog_title)
.setMessage(bRetry ? R.string.unlicensed_dialog_retry_body : R.string.unlicensed_dialog_body)
.setPositiveButton(bRetry ? R.string.retry_button : R.string.buy_button, new DialogInterface.OnClickListener() {
boolean mRetry = bRetry;
public void onClick(DialogInterface dialog, int which) {
if ( mRetry ) {
doCheck();
} else {
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"market:///details?id=" + getPackageName()));
startActivity(marketIntent);
}
}
})
.setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).create();
}
// this is the actual method that called for the licence check.
private void doCheck() {
mChecker.checkAccess(mLicenseCheckerCallback);
}
// this is used to display the result of he licence check
private void displayResult(final String result) {
mHandler.post(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(), result ,Toast.LENGTH_SHORT).show();
}
});
}
// this shows the dialog if the licence check came back with a problem. Either the user did not pay for it or we did an error.
private void displayDialog(final boolean showRetry) {
mHandler.post(new Runnable() {
#SuppressWarnings("deprecation")
public void run() {
showDialog(showRetry ? 1 : 0);//calls the dialog
}
});
}
...
...
the rest of the class
The LicenseCheckerCallback class in the main class:
// this is an internal class that should be inside the main activity that is used for license checking. The licensing lib call this when
// it is done with checking the license
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
public void allow(int policyReason) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// Should allow user access.
displayResult(getString(R.string.allow));
}
public void dontAllow(int policyReason) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
displayResult(getString(R.string.dont_allow));
// Should not allow access. In most cases, the app should assume
// the user has access unless it encounters this. If it does,
// the app should inform the user of their unlicensed ways
// and then either shut down the app or limit the user to a
// restricted set of features.
// In this example, we show a dialog that takes the user to Market.
// If the reason for the lack of license is that the service is
// unavailable or there is another problem, we display a
// retry button on the dialog and a different message.
displayDialog(policyReason == Policy.RETRY);
}
public void applicationError(int errorCode) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// This is a polite way of saying the developer made a mistake
// while setting up or calling the license checker library.
// Please examine the error code and fix the error.
String result = String.format(getString(R.string.application_error), errorCode);
displayResult(result);
}
}
#Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
}
I am using the ServerManagedPolicy . So I have not changed anything in the library files(I don't have to do I?). And I do have the in the manifest.
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
I cant work out what I am doing wrong. All of this is entirely based on the sample app.
My question is : how do I get the Licence check to work properly?
Note : If you plan on downvoting , pls tell me why.
Thanks for taking the time to read this and for any help that you can give.
Cheers.

Related

Check for update within android application not on Google Play

I'm pretty much new to android coding, so I'm sorry if I make some mistakes while asking the question.
I'm trying to implement in-app updates for a personal use application and not to be put up on the play store. I've searched my way through stack and found various methods through which that can be achieved. So I tried my own. But the thing is, it doesn't work sometimes, and sometimes it shows wrong information about the update being available. To be more specific, when I compare the curVersionCode to newVersionCode, where curVersionCode = newVersionCode, it still shows that the newer version is available.
Here's My Activity -
public class Test extends Activity {
private Handler mHandler;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.front);
mHandler = new Handler();
checkUpdate.start();
}
}
/* This Thread checks for Updates in the Background */
private Thread checkUpdate = new Thread() {
public void run() {
try {
URL updateURL = new URL("URL TO THE TXT FILE");
BufferedReader in = new BufferedReader(new InputStreamReader(updateURL.openStream()));
String str;
while ((str = in.readLine()) != null) {
// str is one line of text; readLine() strips the newline character(s)
/* Get current Version Number */
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
int curVersion = packageInfo.versionCode;
int newVersion = Integer.valueOf(str);
/* Is a higher version than the current already out? */
if (newVersion > curVersion) {
/* Post a Handler for the UI to pick up and open the Dialog */
mHandler.post(showUpdate);
}
}
in.close();
} catch (Exception e) {
}
}
};
/* This Runnable creates a Dialog and asks the user to open the Update Link*/
private Runnable showUpdate = new Runnable(){
public void run(){
new AlertDialog.Builder(BrowserActivity.this)
.setIcon(R.drawable.ic_launcher)
.setTitle("Update Available")
.setMessage("An update for is available!\n\nOpen Update page and see the details?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked OK so do some stuff */
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("URL TO THE UPDATE FILE"));
startActivity(intent);
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked Cancel */
}
})
.show();
}
};
Been searching for a few days, still ain't able to find the answer. I'm sorry if this is a basic question but I'm pretty new to it.
Thanks.
EDIT : The code now works just fine. Turns out it requires some time to refresh the version code over the internet text file. Doesn't matter, got experience.

Android Licensing Error 561 -This application is not licensed. Please purchase it from Android Market

I have no clue whether am I doing a correct implementation of LVL.
Please guide me with this issue.
I followed some of the answers like clearing the cache, uninstalling and reinsatlling.
Still no luck..
I tried the following steps before uploading to alpha testing.
I am using Eclipse. I created a keystore using the export signed application package option
Uploaded the APK from the keystore.
Following is my code, which I took from How to license my Android application?
public class Activity_LicenseCheck extends Activity {
private class MyLicenseCheckerCallback implements LicenseCheckerCallback{
#Override
public void allow(int reason) {
toast("Inside-Allow:" + reason);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
startMainActivity();
}
#Override
public void dontAllow(int reason) {
toast("dontAllow: " + reason);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
}
#Override
public void applicationError(int errorCode) {
if (isFinishing()) {
return;
}
toast("Errorffff: " + errorCode);
startMainActivity();
}
}
private static final String BASE64_PUBLIC_KEY = "mykey";
private static final byte[] SALT = new byte[] {11,34,56,36,3,45,-87,2,67,-98,32,-14,44,-58,39,-26,72,-19,86,23};
private LicenseChecker mChecker;
// A handler on the UI thread.
private LicenseCheckerCallback mLicenseCheckerCallback;
private void doCheck() {
mChecker.checkAccess(mLicenseCheckerCallback);
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(),
Secure.ANDROID_ID);
// Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
}
#Override
protected Dialog onCreateDialog(int id) {
// We have only one dialog.
return new AlertDialog.Builder(this)
.setTitle("Application Not Licensed")
.setCancelable(false)
.setMessage(
"This application is not licensed. Please purchase it from Android Market")
.setPositiveButton("Buy App",
new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog,
int which) {
Intent marketIntent = new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://market.android.com/details?id="
+ getPackageName()));
startActivity(marketIntent);
finish();
}
})
.setNegativeButton("Exit",
new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog,
int which) {
finish();
}
}).create();
}
#Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
private void startMainActivity() {
startActivity(new Intent(this, Activity_login.class));
finish();
}
public void toast(String string) {
Toast.makeText(this, string, Toast.LENGTH_SHORT).show();
}
}
Finally it worked the issue was the wrong entry of BASE64 PUBLIC KEY.I was completely clueless about the licencing concept google should come up with easy solution.
How it worked for me..
My first publish was ver 1.0 and i was getting error 561.(Not licenced)
the isuue was wrong BASE64 PUBLIC KEY entry then i replaced it with the correct one and changed application version to 2.0 in Androidmanifest.xml and regenerated keystore and finally uploaded apk to the developer console and disabled version 1 and published version 2 in the console. when downloaded new apk from the console still facing issue the app was throwing "Error retrieving information from server [RPC:S-7:AEC-0]" error. i googled and found the solution, rebooted the device and it worked

What is the application error:6 in Android licensing

Here is my code:
Some time I get Application error :3 or :6 and some time I get application not licensed dialog.
public class MainActivity extends Activity {
private static final String BASE64_PUBLIC_KEY = "my public key";
// Generate your own 20 random bytes, and put them here.
private static final byte[] SALT = new byte[] {
-43, 12, 76, -124, -101, -57, 74, -64, 51, 88, -95, -45, 77, -117, -36, -113, -11, 32, -64,
89
};
private TextView mStatusText;
private Button mCheckLicenseButton;
private LicenseCheckerCallback mLicenseCheckerCallback;
private LicenseChecker mChecker;
// A handler on the UI thread.
private Handler mHandler;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.main);
mStatusText = (TextView) findViewById(R.id.status_text);
mCheckLicenseButton = (Button) findViewById(R.id.check_license_button);
mCheckLicenseButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
doCheck();
}
});
mHandler = new Handler();
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
// Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(
this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
}
protected Dialog onCreateDialog(int id) {
final boolean bRetry = id == 1;
return new AlertDialog.Builder(this)
.setTitle(R.string.unlicensed_dialog_title)
.setMessage(bRetry ? R.string.unlicensed_dialog_retry_body : R.string.unlicensed_dialog_body)
.setPositiveButton(bRetry ? R.string.retry_button : R.string.buy_button, new DialogInterface.OnClickListener() {
boolean mRetry = bRetry;
public void onClick(DialogInterface dialog, int which) {
if ( mRetry ) {
doCheck();
} else {
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"http://play.google.com/store/apps/details?id=com.android.SendEmail"));
startActivity(marketIntent);
}
}
})
.setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).create();
}
private void doCheck() {
mCheckLicenseButton.setEnabled(false);
setProgressBarIndeterminateVisibility(true);
mStatusText.setText(R.string.checking_license);
mChecker.checkAccess(mLicenseCheckerCallback);
}
private void displayResult(final String result) {
mHandler.post(new Runnable() {
public void run() {
mStatusText.setText(result);
setProgressBarIndeterminateVisibility(false);
mCheckLicenseButton.setEnabled(true);
}
});
}
private void displayDialog(final boolean showRetry) {
mHandler.post(new Runnable() {
public void run() {
setProgressBarIndeterminateVisibility(false);
showDialog(showRetry ? 1 : 0);
mCheckLicenseButton.setEnabled(true);
}
});
}
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
public void allow(int policyReason) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// Should allow user access.
displayResult(getString(R.string.allow));
}
public void dontAllow(int policyReason) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
displayResult(getString(R.string.dont_allow));
// Should not allow access. In most cases, the app should assume
// the user has access unless it encounters this. If it does,
// the app should inform the user of their unlicensed ways
// and then either shut down the app or limit the user to a
// restricted set of features.
// In this example, we show a dialog that takes the user to Market.
// If the reason for the lack of license is that the service is
// unavailable or there is another problem, we display a
// retry button on the dialog and a different message.
displayDialog(policyReason == Policy.RETRY);
}
public void applicationError(int errorCode) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// This is a polite way of saying the developer made a mistake
// while setting up or calling the license checker library.
// Please examine the error code and fix the error.
String result = String.format(getString(R.string.application_error), errorCode);
displayResult(result);
}
}
#Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
Error Code 6 means your missing the permission to check for licensing from your application manifest.
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
Error Code 3 means that the app isn't on the Google marketplace so their license server can't determine if they are supposed to have a license or not yet.

This application is not licensed. Please purchase it from Android Market in android

i uploded my app with google license with correct key but when i download the app from store it gives
"This application is not licensed. Please purchase it from Android Market."
here is the code:
public class MainActivity extends Activity {
private static final String BASE64_PUBLIC_KEY = my_app_key;
// Generate your own 20 random bytes, and put them here.
private static final byte[] SALT = new byte[] {
-46, 35, 30, -128, -103, -57, 74, -64, 51, 88, -95, -45, 67, -117, -36, -113, -11, 82, -44,
29
};
private TextView mStatusText;
private LicenseCheckerCallback mLicenseCheckerCallback;
private LicenseChecker mChecker;
// A handler on the UI thread.
private Handler mHandler;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.license);
mStatusText = (TextView) findViewById(R.id.status_text);
mHandler = new Handler();
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
// Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(
this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
}
protected Dialog onCreateDialog(int id) {
final boolean bRetry = id == 1;
return new AlertDialog.Builder(this)
.setTitle(R.string.unlicensed_dialog_title)
.setMessage(bRetry ? R.string.unlicensed_dialog_retry_body : R.string.unlicensed_dialog_body)
.setPositiveButton(bRetry ? R.string.retry_button : R.string.buy_button, new DialogInterface.OnClickListener() {
boolean mRetry = bRetry;
public void onClick(DialogInterface dialog, int which) {
if ( mRetry ) {
doCheck();
} else {
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"http://market.android.com/details?id=" + getPackageName()));
startActivity(marketIntent);
}
}
})
.setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).create();
}
private void doCheck() {
setProgressBarIndeterminateVisibility(true);
mStatusText.setText(R.string.checking_license);
mChecker.checkAccess(mLicenseCheckerCallback);
}
private void displayResult(final String result) {
mHandler.post(new Runnable() {
public void run() {
mStatusText.setText(result);
setProgressBarIndeterminateVisibility(false);
}
});
}
private void displayDialog(final boolean showRetry) {
mHandler.post(new Runnable() {
public void run() {
setProgressBarIndeterminateVisibility(false);
showDialog(showRetry ? 1 : 0);
}
});
}
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
public void allow(int policyReason) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// Should allow user access.
finish();
startActivity(new Intent(MainActivity.this,first.class));
}
public void dontAllow(int policyReason) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
displayResult(getString(R.string.dont_allow));
// Should not allow access. In most cases, the app should assume
// the user has access unless it encounters this. If it does,
// the app should inform the user of their unlicensed ways
// and then either shut down the app or limit the user to a
// restricted set of features.
// In this example, we show a dialog that takes the user to Market.
// If the reason for the lack of license is that the service is
// unavailable or there is another problem, we display a
// retry button on the dialog and a different message.
displayDialog(policyReason == Policy.RETRY);
}
public void applicationError(int errorCode) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// This is a polite way of saying the developer made a mistake
// while setting up or calling the license checker library.
// Please examine the error code and fix the error.
String result = String.format(getString(R.string.application_error), errorCode);
displayResult(result);
}
}
#Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
}
Are you using the same id that you uploaded it with?

Application crashes on second run using splash screen

In My application, I am using thread to show the splash screen. . .
But i have also given the Android Licensing to My Application. Which also uses the thread. . .
But While i am installing the Application it runs once..
if i again open it then it got crash. where is the problem ???
the code is as below :
package com.EMTPrep.Paramedic.app;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings.Secure;
import android.view.Window;
import com.android.vending.licensing.AESObfuscator;
import com.android.vending.licensing.LicenseChecker;
import com.android.vending.licensing.LicenseCheckerCallback;
import com.android.vending.licensing.ServerManagedPolicy;
import com.EMTPrep.Paramedic.app.R;
public class SplashActivity extends Activity
{
private static boolean DEBUG = false;
private static int DURATION;
private Handler splashHandler;
private Runnable launcherRunnable;
private LicenseCheckerCallback mLicenseCheckerCallback;// for the License
private LicenseChecker mChecker;// for the License
// === A handler on the UI thread.
private Handler mHandler;
private static final String BASE64_PUBLIC_KEY = "I have puted the Licensing code here";//// for the License
// === Generate your own 20 random bytes, and put them here.
private static final byte[] SALT = new byte[]
{
-46, 65, 90, -128, -13, -57, 74, -64, 51, 66, -85, -67, 89, -114, -36, 113, 77, 32, -64,
89
}; // for the License
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash);
mHandler = new Handler();
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);// for the License
// === Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();// for the License
// === Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(this, new ServerManagedPolicy(this,new AESObfuscator(SALT, getPackageName(), deviceId)),// for the License
BASE64_PUBLIC_KEY);// for the License
doCheck();// for the License
DURATION = Integer.valueOf(getString(R.string.splash_duration));
splashHandler = new Handler();
// ================ Main Code of the Application
// launcherRunnable = new Runnable() {
// #Override
// public void run() {
// Intent i = new Intent(SplashActivity.this, MainMenuActivity.class);
// i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(i);
// SplashActivity.this.finish();
// }
// };
// if (DEBUG)
// {
// splashHandler.post(launcherRunnable);
// }
// else
// splashHandler.postDelayed(launcherRunnable, DURATION);
//
}
protected Dialog onCreateDialog(int id) //// for the License
{
// We have only one dialog.
return new AlertDialog.Builder(this)
.setTitle(R.string.unlicensed_dialog_title)
.setMessage(R.string.unlicensed_dialog_body)
.setPositiveButton(R.string.buy_button, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"http://market.android.com/details?id=" + getPackageName()));
startActivity(marketIntent);
}
})
.setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.create();
}
private void displayResult(final String result) { // for the License
mHandler.post(new Runnable() {
public void run() {
// mStatusText.setText(result);
setProgressBarIndeterminateVisibility(false);
//mCheckLicenseButton.setEnabled(true);
}
});
}
private class MyLicenseCheckerCallback implements LicenseCheckerCallback // for the License
{
public void allow()
{
if (isFinishing())
{
// Don't update UI if Activity is finishing.
return;
}
// Should allow user access.
launcherRunnable = new Runnable()
{
#Override
public void run()
{
Intent i = new Intent(SplashActivity.this, MainMenuActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
SplashActivity.this.finish();
}
};
if (DEBUG)
{
splashHandler.post(launcherRunnable);
}
else
splashHandler.postDelayed(launcherRunnable, DURATION);
displayResult(getString(R.string.allow));
}
public void dontAllow()
{
if (isFinishing())
{
// Don't update UI if Activity is finishing.
return;
}
displayResult(getString(R.string.dont_allow));
// Should not allow access. An app can handle as needed,
// typically by informing the user that the app is not licensed
// and then shutting down the app or limiting the user to a
// restricted set of features.
// In this example, we show a dialog that takes the user to Market.
showDialog(0);
}
public void applicationError(ApplicationErrorCode errorCode)
{
if (isFinishing())
{
// Don't update UI if Activity is finishing.
return;
}
// This is a polite way of saying the developer made a mistake
// while setting up or calling the license checker library.
// Please examine the error code and fix the error.
String result = String.format(getString(R.string.application_error), errorCode);
displayResult(result);
}
}
private void doCheck()// for the License
{
//mCheckLicenseButton.setEnabled(false);
setProgressBarIndeterminateVisibility(true);
//mStatusText.setText(R.string.checking_license);
mChecker.checkAccess(mLicenseCheckerCallback);
}
#Override // for the License
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
}
I think there might be the problem in thread. . . Please help me to solve it. . Thanks
Please help me in this. . .
And let me tell while i am able to run the application only at once. . .
Thanks in advance.
Can you try splashHandler.postDelayed(new Runnable(), DURATION); ?
and put it up to fields private Handler splashHandler = new Handler();

Categories

Resources