Abrir Google Plus Página Via Intent en Android

Tengo una página de Google Plus

Https://plus.google.com/u/0/b/101839105638971401281/101839105638971401281/posts

Y una aplicación de Android. Quiero abrir esta página en mi aplicación. ¡No quiero abrir el navegador!

Esto abre el navegador:

 URL="https://plus.google.com/b/101839105638971401281/101839105638971401281/posts"; uri = Uri.parse(URL); it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); 

Esto se bloquea:

  Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName("com.google.android.apps.plus", "com.google.android.apps.plus.phone.UrlGatewayActivity"); intent.putExtra("customAppUri", "10183910563897140128"); startActivity(intent); 

¡Gracias por adelantado!

[SOLUCIONADO]

 startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/101839105638971401281/posts"))); 

Con esta solución, el usuario puede elegir la aplicación de Google Plus o abrir el navegador. Si se elige la APP, no se producirá un bloqueo.

Si el usuario tiene instalada la aplicación Google+, puede hacerlo:

 startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/101839105638971401281/posts"))); 

Observe la sintaxis del URI, y que no contiene /b/id/ .

Usted tiene que comprobar primero que el usuario ya tiene G + App en su teléfono o no? En caso afirmativo, podemos iniciarlo por intención específica o podemos usar la redirección del navegador a una página específica.

Aquí hay un método en tal flujo,

 public void openGPlus(String profile) { try { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName("com.google.android.apps.plus", "com.google.android.apps.plus.phone.UrlGatewayActivity"); intent.putExtra("customAppUri", profile); startActivity(intent); } catch(ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/"+profile+"/posts"))); } } 

Ahora usted puede llamar a este método simplemente como,

 //117004778634926368759 is my google plus id openGPlus("117004778634926368759"); 

Respuesta extendida : De la misma manera para twitter y facebook que puede utilizar ,

Para Twitter ,

 public void openTwtr(String twtrName) { try { startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("twitter://user?screen_name=" + twtrName))); } catch (ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("https://twitter.com/#!/" + twtrName))); } } 

Y para Facebook ,

 public void openFB(String facebookId) { try{ String facebookScheme = "fb://profile/" + facebookId; Intent facebookIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(facebookScheme)); startActivity(facebookIntent); } catch (ActivityNotFoundException e) { Intent facebookIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://www.facebook.com/profile.php?id="+facebookId)); startActivity(facebookIntent); } } 
 /** * Intent to open the official Google+ app to the user's profile. If the Google+ app is not * installed then the Web Browser will be used. * * </br></br>Example usage:</br> * <code>newGooglePlusIntent(context.getPackageManager(), "https://plus.google.com/+JaredRummler");</code> * * @param pm * The {@link PackageManager}. * @param url * The URL to the user's Google+ profile. * @return The intent to open the Google+ app to the user's profile. */ public static Intent newGooglePlusIntent(PackageManager pm, String url) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); try { if (pm.getPackageInfo("com.google.android.apps.plus", 0) != null) { intent.setPackage("com.google.android.apps.plus"); } } catch (NameNotFoundException e) { } return intent; } 

¿Qué dice la pila de seguimiento cuando se bloquea?

También no estoy seguro si esto haría una diferencia, pero hay un error tipográfico en la identificación. Tu escribiste:

 intent.putExtra("customAppUri", "10183910563897140128"); 

Pero originalmente el ID era 101839105638971401281 . Dejaste el 1 al final.

¿Por qué no sólo Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); . El sistema operativo Android consulta todas las aplicaciones que pueden gestionar un Uri específico. Google+, como una aplicación, está programada para poder manejar el Uri que está solicitando. Por lo tanto, se mostrará como una opción en un selector (o simplemente ir a él si el usuario ya ha seleccionado la aplicación de Google + por defecto para ese Uri.

  • Problema de redireccionamiento de Webview
  • Api de Google+ que trabaja en el dispositivo a través de android studio pero no después del despliegue de la aplicación en playstore
  • Mensaje INVALID_KEY que intenta autenticarse mediante el botón de inicio de sesión de Google+
  • Android: falla en el estado de la cuenta de Google+
  • Cómo compartir texto e imagen en Google Plus (G +) de android sin utilizar Intent?
  • Se ha producido un error interno con la integración de Google Plus Login
  • Android Google Plus SDK: cómo obtener la devolución de llamada en el botón +1 (PlusOneButton)
  • Servicios de Google Play en el emulador, implementación del botón de inicio de sesión de Google Plus, etc.
  • Obtener la solicitud de permiso "tener acceso sin conexión" al llamar a GoogleAuthUtil.getToken
  • Google-plus: incapaz de cargar la persona
  • Com.android.build.transform.api.TransformException con los servicios de google play de android
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.