Android Package Manage getApplicationMarketPage( @Nonnull String packageName)

Here you can find the source of getApplicationMarketPage( @Nonnull String packageName)

Description

Returns an Intent with action Intent#ACTION_VIEW to open the Google Play page for the passed package name.

License

Apache License

Parameter

Parameter Description
packageName A full, valid Google Play application package name

Declaration

@Nonnull
public static Intent getApplicationMarketPage(
        @Nonnull String packageName) 

Method Source Code

//package com.java2s;
/*/*from   ww  w  .ja v  a  2  s  .  co  m*/
 * Copyright 2013 Luluvise Ltd
 * Copyright 2013 Marco Salis - fast3r(at)gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import javax.annotation.Nonnull;

import android.content.Intent;

import android.net.Uri;

public class Main {
    /**
     * Returns an {@link Intent} with action {@link Intent#ACTION_VIEW} to open
     * the Google Play page for the passed package name.
     * 
     * @param packageName
     *            A full, valid Google Play application package name
     */
    @Nonnull
    public static Intent getApplicationMarketPage(
            @Nonnull String packageName) {
        return getViewUrlIntent("market://details?id=" + packageName);
    }

    /**
     * Creates an {@link Intent} to open the passed URI with the default
     * application that handles {@link Intent#ACTION_VIEW} for that content.
     * 
     * @param uri
     *            The URI string (must be non null)
     * @return The created intent
     */
    @Nonnull
    public static Intent getViewUrlIntent(@Nonnull String uri) {
        return new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
    }
}

Related

  1. getApplicationIcon(String packageName)
  2. getUidForPackageName(PackageManager pm, String packageName)
  3. disableComponent(PackageManager pm, ComponentName component)
  4. enableComponent(PackageManager pm, ComponentName component)
  5. isPackageInstalled(String packageName, PackageManager pm)
  6. isPackageInstalled(final String packageName, final PackageManager pm)
  7. isSpeechRecognitionActivityPresented( Activity callerActivity)
  8. uninstall(Context context, String packageName)
  9. uninstallApp(Context context, String packageName)