studio play paquete nombre google example editar cambiar application aplicaciones aplicacion androidmanifest administrar android user-input rating voting

play - id de aplicacion android



Pedirle al usuario que califique una aplicaciĆ³n de Android dentro de la aplicaciĆ³n (10)

En mi aplicación de Android, quiero pedirle al usuario en algún momento que califique la aplicación en Android Market.

Habiendo buscado un enfoque, he encontrado algún código en este sitio web . Este código parece funcionar muy bien.

Pero desafortunadamente, este código parece generar un mensaje de error de "Cierre forzado" cuando Android Market no está instalado en el teléfono del usuario. ¿Hay alguna forma de verificar si Android Market está instalado y, de no ser así, no intente ejecutar el código?

La línea que genera el error es probablemente esta, ya que no puede analizar el URI:

mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));

Y, por cierto, ¿hay otras cosas que podrían mejorarse en ese código?

Editar:

Unos años más tarde, puse todo el código en un pequeño proyecto de biblioteca: AppRater en GitHub


Aquí está todo el código que necesita (un conglomerado de respuestas e información inferida de Kurt, más el enlace y la pregunta):

/* This code assumes you are inside an activity */ final Uri uri = Uri.parse("market://details?id=" + getApplicationContext().getPackageName()); final Intent rateAppIntent = new Intent(Intent.ACTION_VIEW, uri); if (getPackageManager().queryIntentActivities(rateAppIntent, 0).size() > 0) { startActivity(rateAppIntent); } else { /* handle your error case: the device has no way to handle market urls */ }


Cuando uso "market: // details? Id =" + getApplicationContext (). GetPackageName () me abre el mercado de mobogenie, así que prefiero usar https://play.google.com/store/apps/details?id= "+ getApplicationContext (). getPackageName ()


Este simple código logrará lo que desea, sin necesidad de bibliotecas externas ni nada sofisticado. Solo póngalo en el evento OnCreate en su actividad principal. La variable RunEvery determinará con qué frecuencia aparecerá el mensaje de velocidad. En el ejemplo se establece en 10.

// Count times app has been opened, display rating message after number of times // By Rafael Duval try { // Get the app''s shared preferences SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(this); // Get the value for the run counter int counter = app_preferences.getInt("counter", 0); // Do every x times int RunEvery = 10; if(counter != 0 && counter % RunEvery == 0 ) { //Toast.makeText(this, "This app has been started " + counter + " times.", Toast.LENGTH_SHORT).show(); AlertDialog.Builder alert = new AlertDialog.Builder( MyActivity.this); alert.setTitle("Please rate"); alert.setIcon(R.drawable.ic_launcher); //app icon here alert.setMessage("Thanks for using this free app. Please take a moment to rate it."); alert.setPositiveButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //Do nothing } }); alert.setNegativeButton("Rate it", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { final String appName = getApplicationContext().getPackageName(); try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent( Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appName))); } } }); alert.show(); } // Increment the counter SharedPreferences.Editor editor = app_preferences.edit(); editor.putInt("counter", ++counter); editor.commit(); // Very important } catch (Exception e) { //Do nothing, don''t run but don''t break }



No todos los dispositivos Android utilizan el mercado de aplicaciones. Kindle y Nook tienen su propio mercado, por lo que la necesidad de un código para verificar si el mercado existe es bueno. Aunque debería haber una manera de enviar la calificación al mercado correcto, no importa cuál sea. Algo para mirar.


Primero necesitas contar los tiempos de aplicación utilizados;

SharedPreferences preferences = getSharedPreferences("progress", MODE_PRIVATE); int appUsedCount = preferences.getInt("appUsedCount",0); appUsedCount++; SharedPreferences.Editor editor = preferences.edit(); editor.putInt("appUsedCount", appUsedCount); editor.apply(); if (appUsedCount==10 || appUsedCount==50 || appUsedCount==100 || appUsedCount==200 || appUsedCount==300){ AskForRating(appUsedCount); } else { finish(); }

De lo que puedes pedir de esta manera;

private void AskForRating(int _appUsedCount){ AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Please Rate Us"); alert.setIcon(R.drawable.book); alert.setMessage("Thanks for using the application. If you like YOUR APP NAME please rate us! Your feedback is important for us!"); alert.setPositiveButton("Rate it",new Dialog.OnClickListener(){ public void onClick(DialogInterface dialog, int whichButton){ String url = "https://play.google.com/store/apps/details?id=YOUR PACKAGE NAME"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); alert.setNegativeButton("Not now", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); alert.show(); }


Si la aplicación se descargó a través de Android Market, los usuarios tendrán Android Market instalado en el teléfono, por lo que realmente no veo esto como un problema. Parece muy raro ...

Puede usar lo siguiente para iniciar Android Market en la página de su aplicación, es un poco más automatizado:

Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("market://details?id=" + getPackageName())); startActivity(i);


Siempre puede llamar a getInstalledPackages() desde la clase PackageManager y verificar que la clase de mercado esté instalada. También puede usar queryIntentActivities() para asegurarse de que el Intent que construye pueda ser manejado por algo, incluso si no es la aplicación de mercado. Esto es probablemente lo mejor que se puede hacer en realidad porque es el más flexible y robusto.


También puede usar RateMeMaybe: https://github.com/Kopfgeldjaeger/RateMeMaybe

Le ofrece bastantes opciones para configurar (mínimo de días / inicia hasta el primer aviso, mínimo de días / inicia hasta cada siguiente aviso si el usuario elige "no ahora", título del diálogo, mensaje, etc.). También es fácil de usar.

Ejemplo de uso de README:

RateMeMaybe rmm = new RateMeMaybe(this); rmm.setPromptMinimums(10, 14, 10, 30); rmm.setDialogMessage("You really seem to like this app, " +"since you have already used it %totalLaunchCount% times! " +"It would be great if you took a moment to rate it."); rmm.setDialogTitle("Rate this app"); rmm.setPositiveBtn("Yeeha!"); rmm.run();


usa este código

Uri uri = Uri.parse("market://details?id=" + context.getPackageName()); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); // To count with Play market backstack, After pressing back button, // to taken back to our application, we need to add following flags to intent. goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); try { startActivity(goToMarket); } catch (ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + context.getPackageName()))); }