todas samsung play para las gratis google descargar celular app aplicaciones actualizar android android-intent google-play

android - samsung - play store web



¿Cómo abrir Google Play Store directamente desde mi aplicación de Android? (19)

He abierto la tienda de Google Play usando el siguiente código

Intent i = new Intent(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse("https://play.google.com/store/apps/details?id=my packagename ")); startActivity(i);.

Pero me muestra una vista de acción completa para seleccionar la opción (navegador / play store). Necesito abrir la aplicación en playstore directamente.


Kotlin

fun openAppInPlayStore(appPackageName: String) { try { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$appPackageName"))) } catch (exception: android.content.ActivityNotFoundException) { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=$appPackageName"))) } }


Aquí está el código final de las respuestas anteriores que intentan abrir la aplicación utilizando la aplicación Google Play Store y específicamente Play Store. Si falla, iniciará la vista de acción utilizando la versión web: Créditos para @Eric, @Jonathan Caballero

public void goToPlayStore() { String playStoreMarketUrl = "market://details?id="; String playStoreWebUrl = "https://play.google.com/store/apps/details?id="; String packageName = getActivity().getPackageName(); try { Intent intent = getActivity() .getPackageManager() .getLaunchIntentForPackage("com.android.vending"); if (intent != null) { ComponentName androidComponent = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); intent.setComponent(androidComponent); intent.setData(Uri.parse(playStoreMarketUrl + packageName)); } else { intent = new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreMarketUrl + packageName)); } startActivity(intent); } catch (ActivityNotFoundException e) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreWebUrl + packageName)); startActivity(intent); } }


Este enlace abrirá la aplicación automáticamente en market: // si está en Android y en el navegador si está en la PC.

https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=com.app.id&ddl=1&pcampaignid=web_ddl_1


He combinado la respuesta de Berťák y Stefano Munarini a la creación de una solución híbrida que maneja tanto el escenario Calificar esta aplicación como Mostrar más aplicaciones .

/** * This method checks if GooglePlay is installed or not on the device and accordingly handle * Intents to view for rate App or Publisher''s Profile * * @param showPublisherProfile pass true if you want to open Publisher Page else pass false to open APp page * @param publisherID pass Dev ID if you have passed PublisherProfile true */ public void openPlayStore(boolean showPublisherProfile, String publisherID) { //Error Handling if (publisherID == null || !publisherID.isEmpty()) { publisherID = ""; //Log and continue Log.w("openPlayStore Method", "publisherID is invalid"); } Intent openPlayStoreIntent; boolean isGooglePlayInstalled = false; if (showPublisherProfile) { //Open Publishers Profile on PlayStore openPlayStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:" + publisherID)); } else { //Open this App on PlayStore openPlayStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())); } // find all applications who can handle openPlayStoreIntent final List<ResolveInfo> otherApps = getPackageManager() .queryIntentActivities(openPlayStoreIntent, 0); for (ResolveInfo otherApp : otherApps) { // look for Google Play application if (otherApp.activityInfo.applicationInfo.packageName.equals("com.android.vending")) { ActivityInfo otherAppActivity = otherApp.activityInfo; ComponentName componentName = new ComponentName( otherAppActivity.applicationInfo.packageName, otherAppActivity.name ); // make sure it does NOT open in the stack of your activity openPlayStoreIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // task reparenting if needed openPlayStoreIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); // if the Google Play was already open in a search result // this make sure it still go to the app page you requested openPlayStoreIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // this make sure only the Google Play app is allowed to // intercept the intent openPlayStoreIntent.setComponent(componentName); startActivity(openPlayStoreIntent); isGooglePlayInstalled = true; break; } } // if Google Play is not Installed on the device, open web browser if (!isGooglePlayInstalled) { Intent webIntent; if (showPublisherProfile) { //Open Publishers Profile on web browser webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/search?q=pub:" + getPackageName())); } else { //Open this App on web browser webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName())); } startActivity(webIntent); } }

Uso

  • Para abrir el perfil de los editores

@OnClick(R.id.ll_more_apps) public void showMoreApps() { openPlayStore(true, "Hitesh Sahu"); }

  • Para abrir la página de la aplicación en PlayStore

@OnClick(R.id.ll_rate_this_app) public void openAppInPlayStore() { openPlayStore(false, ""); }


Mi función kotlin entension para este propósito

fun Context.canPerformIntent(intent: Intent): Boolean { val mgr = this.packageManager val list = mgr.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY) return list.size > 0 }

Y en tu actividad

val uri = if (canPerformIntent(Intent(Intent.ACTION_VIEW, Uri.parse("market://")))) { Uri.parse("market://details?id=" + appPackageName) } else { Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName) } startActivity(Intent(Intent.ACTION_VIEW, uri))


Muy tarde en la fiesta. Los documentos oficiales están aquí. Y el código descrito es

Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse( "https://play.google.com/store/apps/details?id=com.example.android")); intent.setPackage("com.android.vending"); startActivity(intent);

Cuando configure esta intención, pase "com.android.vending" a Intent.setPackage() para que los usuarios vean los detalles de su aplicación en la aplicación Google Play Store en lugar de un selector . para KOTLIN

val intent = Intent(Intent.ACTION_VIEW).apply { data = Uri.parse( "https://play.google.com/store/apps/details?id=com.example.android") setPackage("com.android.vending") } startActivity(intent)

Si ha publicado una aplicación instantánea utilizando Google Play Instant, puede iniciar la aplicación de la siguiente manera:

Intent intent = new Intent(Intent.ACTION_VIEW); Uri.Builder uriBuilder = Uri.parse("https://play.google.com/store/apps/details") .buildUpon() .appendQueryParameter("id", "com.example.android") .appendQueryParameter("launch", "true"); // Optional parameters, such as referrer, are passed onto the launched // instant app. You can retrieve these parameters using // Activity.getIntent().getData(). uriBuilder.appendQueryParameter("referrer", "exampleCampaignId"); intent.setData(uriBuilder.build()); intent.setPackage("com.android.vending"); startActivity(intent);

Para KOTLIN

val uriBuilder = Uri.parse("https://play.google.com/store/apps/details") .buildUpon() .appendQueryParameter("id", "com.example.android") .appendQueryParameter("launch", "true") // Optional parameters, such as referrer, are passed onto the launched // instant app. You can retrieve these parameters using Activity.intent.data. uriBuilder.appendQueryParameter("referrer", "exampleCampaignId") val intent = Intent(Intent.ACTION_VIEW).apply { data = uriBuilder.build() setPackage("com.android.vending") } startActivity(intent)


Puede verificar si la aplicación Google Play Store está instalada y, si este es el caso, puede usar el protocolo "market: //" .

final String my_package_name = "........." // <- HERE YOUR PACKAGE NAME!! String url = ""; try { //Check whether Google Play store is installed or not: this.getPackageManager().getPackageInfo("com.android.vending", 0); url = "market://details?id=" + my_package_name; } catch ( final Exception e ) { url = "https://play.google.com/store/apps/details?id=" + my_package_name; } //Open the app page in Google Play store: final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(intent);


Puedes hacerlo usando el prefijo market:// .

final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); }

Usamos un bloque try/catch aquí porque se lanzará una Exception si el Play Store no está instalado en el dispositivo de destino.

NOTA : cualquier aplicación puede registrarse como capaz de manejar el market://details?id=<appId> Uri, si desea apuntar específicamente a Google Play, verifique la respuesta de Berťák


Si bien la respuesta de Eric es correcta y el código de Berťák también funciona. Creo que esto combina los dos con más elegancia.

try { Intent appStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)); appStoreIntent.setPackage("com.android.vending"); startActivity(appStoreIntent); } catch (android.content.ActivityNotFoundException exception) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); }

Al usar setPackage , setPackage al dispositivo a usar Play Store. Si no hay Play Store instalado, la Exception se detectará.


Si desea abrir Google Play store desde su aplicación, use este comando directy: market://details?gotohome=com.yourAppName , abrirá las páginas de la tienda Google Play de su aplicación.

Mostrar todas las aplicaciones por un editor específico

Buscar aplicaciones que utilicen la consulta en su título o descripción.

Referencia: https://tricklio.com/market-details-gotohome-1/


Si desea abrir Play Market para buscar aplicaciones (por ejemplo, "pdf"), use esto:

private void openPlayMarket(String query) { try { // If Play Services are installed. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=" + query))); } catch (ActivityNotFoundException e) { // Open in a browser. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/search?q=" + query))); } }


Solución lista para usar:

public class GoogleServicesUtils { public static void openAppInGooglePlay(Context context) { final String appPackageName = context.getPackageName(); try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException e) { // if there is no Google Play on device context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } }

Basado en la respuesta de Eric.



Vaya al enlace oficial de Android Developer como tutorial, vea y obtenga el código para su paquete de aplicaciones de Play Store si existe o si no existe Play Store, entonces abra la aplicación desde el navegador web.

Desarrollador de Android enlace oficial

http://developer.android.com/distribute/tools/promote/linking.html

Enlace a una página de aplicación

Desde un sitio web: http://play.google.com/store/apps/details?id=<package_name>

Desde una aplicación de Android: market://details?id=<package_name>

Enlace a una lista de productos

Desde un sitio web: http://play.google.com/store/search?q=pub:<publisher_name>

Desde una aplicación de Android: market://search?q=pub:<publisher_name>

Enlace a un resultado de búsqueda

Desde un sitio web: http://play.google.com/store/search?q=<search_query>&c=apps

Desde una aplicación de Android: market://search?q=<seach_query>&c=apps


mercado de uso: //

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + my_packagename));


prueba esto

Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=com.example.android")); startActivity(intent);


Muchas respuestas aquí sugieren usar Uri.parse("market://details?id=" + appPackageName)) para abrir Google Play, pero creo que de hecho no es suficiente :

Algunas aplicaciones de terceros pueden usar sus propios filtros de intención con el esquema "market://" definido , por lo que pueden procesar el Uri suministrado en lugar de Google Play (experimenté esta situación con la aplicación egSnapPea). La pregunta es "¿Cómo abrir Google Play Store?", Por lo que supongo que no desea abrir ninguna otra aplicación. Tenga en cuenta que, por ejemplo, la calificación de la aplicación solo es relevante en la aplicación GP Store, etc.

Para abrir Google Play Y SOLO para Google Play utilizo este método:

public static void openAppRating(Context context) { // you can also use BuildConfig.APPLICATION_ID String appId = context.getPackageName(); Intent rateIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appId)); boolean marketFound = false; // find all applications able to handle our rateIntent final List<ResolveInfo> otherApps = context.getPackageManager() .queryIntentActivities(rateIntent, 0); for (ResolveInfo otherApp: otherApps) { // look for Google Play application if (otherApp.activityInfo.applicationInfo.packageName .equals("com.android.vending")) { ActivityInfo otherAppActivity = otherApp.activityInfo; ComponentName componentName = new ComponentName( otherAppActivity.applicationInfo.packageName, otherAppActivity.name ); // make sure it does NOT open in the stack of your activity rateIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // task reparenting if needed rateIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); // if the Google Play was already open in a search result // this make sure it still go to the app page you requested rateIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // this make sure only the Google Play app is allowed to // intercept the intent rateIntent.setComponent(componentName); context.startActivity(rateIntent); marketFound = true; break; } } // if GP not present on device, open web browser if (!marketFound) { Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id="+appId)); context.startActivity(webIntent); } }

El punto es que cuando más aplicaciones junto a Google Play pueden abrir nuestra intención, se omite el cuadro de diálogo de selección de aplicaciones y se inicia la aplicación GP directamente.

ACTUALIZACIÓN: A veces parece que solo abre la aplicación GP, ​​sin abrir el perfil de la aplicación. Como TrevorWiley sugirió en su comentario, Intent.FLAG_ACTIVITY_CLEAR_TOP podría solucionar el problema. (Yo no lo probé todavía ...)

Consulta esta respuesta para comprender lo que hace Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED .


Todas las respuestas anteriores abren Google Play en una nueva vista de la misma aplicación, si realmente desea abrir Google Play (o cualquier otra aplicación) de forma independiente:

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending"); // package name and activity ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); launchIntent.setComponent(comp); // sample to open facebook app launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana")); startActivity(launchIntent);

La parte importante es que realmente abre Google Play o cualquier otra aplicación de forma independiente.

La mayoría de lo que he visto utiliza el enfoque de las otras respuestas y no fue lo que necesitaba, espero que esto ayude a alguien.

Saludos.


public void launchPlayStore(Context context, String packageName) { Intent intent = null; try { intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("market://details?id=" + packageName)); context.startActivity(intent); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName))); } }