Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3937576
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:05:06+00:00 2026-05-20T00:05:06+00:00

Our application launches ListActivity that displays two menu options with launch a football game

  • 0

Our application launches ListActivity that displays two menu options with launch a football game and a baseball game. We are trying to implement licensing and we are having troubles figuring out how to get it working. Two things are happening here: we are failing to bind to the licensing service (Unable to start service Intent act=com.android.vending.licensing.ILicensingService in logcat) and we are unable to see any of the status messages. Here is our Launcher code:

public class Launcher extends ListActivity {

    private MenuAdapter mListAdapter;
    private Handler mHandler;
    private TextView mStatusText;
    // protected Button mCheckLicenseButton;

    private LicenseCheckerCallback mLicenseCheckerCallback;
    private LicenseChecker mChecker;

    private static final String BASE64_PUBLIC_KEY = "blah";
    private static final byte[] SALT = new byte[] { 15, -43, -69, 107, 104,
            -111, -105, -76, -18, -24, 62, 118, 45, 67, -89, 70, 79, 123, -3,
            13 };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setContentView(R.layout.launcher_menu);

        mStatusText = (TextView) findViewById(R.id.status_text);

        mHandler = new Handler();

        String android_id = Secure.getString(this.getContentResolver(),
                Secure.ANDROID_ID);

        mLicenseCheckerCallback = new MyLicenseCheckerCallback();

        mChecker = new LicenseChecker(this, new ServerManagedPolicy(this,
                new AESObfuscator(SALT, getPackageName(), android_id)),
                BASE64_PUBLIC_KEY);
        doCheck();
        // We want to see the license check and then launch the menuadapter.
        // mListAdapter = new MenuAdapter(this);
        // this.setListAdapter(mListAdapter);

    }

    protected Dialog onCreateDialog(int id) {
        // 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 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 class MyLicenseCheckerCallback implements LicenseCheckerCallback {
        public void allow() {
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            // Should allow user access.
            displayResult(getString(R.string.allow));
            // If allowed we should display our menu options
            // mListAdapter = new MenuAdapter(this);
            // this.setListAdapter(mListAdapter);
        }

        public void dontAllow() {
            if (isFinishing()) {
                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 our case, we are failing to bind to the licensing service, so showDialog will always display.
            // Temporarily disable it till we get this working.
            // showDialog(0);
        }

        public void applicationError(ApplicationErrorCode errorCode) {
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            String result = String.format(
                    getString(R.string.application_error), errorCode);
            displayResult(result);

        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mChecker.onDestroy();
    }

    @Override
    protected void onListItemClick(ListView lv, View v, int position, long id) {
        super.onListItemClick(lv, v, position, id);
        Activity act = (Activity) this.getListAdapter().getItem(position);
        this.startActivity(new Intent(this, act.Class));
    }

}

All the examples show how to work with an Activity, not a list activity, and this is what is throwing us off. I’m thinking we need to create a MainActivity which extends Activity that does the check then call the ListActivity if the check is successful. Does that sound like the correct approach?

As for failing to bind to the licensing service, this could be network related. We are testing on a Google API lvl 9 emulator, but we don’t get the same failure to bind on the Nexus One or Galaxy Tab.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:05:06+00:00Added an answer on May 20, 2026 at 12:05 am

    As for failing to bind to the licensing service, this could be network related. We are testing on a Google API lvl 9 emulator, but we don’t get the same failure to bind on the Nexus One or Galaxy Tab.

    This is actually just an issue with Gingerbread in the emulator. The bug is reported here:
    http://code.google.com/p/marketlicensing/issues/detail?id=27&q=could%20not%20bind%20to%20service

    You’ll need to test LVL on 2.2 in the emulator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
I'm running a java application that we distribute as a server-side system. I'm trying
We have a scripting engine (running under Windows) that launches another application several thousand
Our Application has a Class that wraps Jersey REST functionality. One Method is public
With some slower machines that our application runs on (which is in the windows
I’m trying to launch an application (Operating System, My Application and the application I
I have an application that is started with JWS. The first time user launches
I wrote a small daemon application in .NET last year that basically launches a
In our Android app, I have an activity that has a gridview that displays
Basically multiple instances of our application will be launched but they need to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.