List of usage examples for android.net Uri.Builder Uri.Builder
Uri.Builder
From source file:it.scoppelletti.mobilepower.app.AppUtils.java
/** * Istanzia l’URL per l’acquisto di un’applicazione. * // w w w . j ava2s . c o m * @param ctx Contesto. * @param rest Indica se comporre un URL REST-like senza parametri di * interrogazione. * @return URL. */ public static Uri newBuyUri(Context ctx, boolean rest) { String pkgName; Uri.Builder uriBuilder; if (ctx == null) { throw new NullPointerException("Argument ctx is null."); } pkgName = AppUtils.getFullPackageName(ctx, false); uriBuilder = new Uri.Builder(); if (rest) { if (pkgName.startsWith(AppUtils.APP_DOMAIN)) { pkgName = pkgName.substring(AppUtils.APP_DOMAIN.length()); } uriBuilder.scheme("http").authority("www.scoppelletti.it").appendPath("mobilepower") .appendPath("android").appendPath(pkgName); } else { uriBuilder.scheme("http").authority("play.google.com").appendPath("store").appendPath("apps") .appendPath("details").appendQueryParameter("id", pkgName); } return uriBuilder.build(); }
From source file:it.scoppelletti.mobilepower.app.AppUtils.java
/** * Istanzia l’intento per l’acquisto di un’applicazione. * // w w w. j a va 2 s . c o m * @param ctx Contesto. * @return Intento. */ public static Intent newBuyIntent(Context ctx) { String pkgName; Intent intent; Uri.Builder uriBuilder; if (ctx == null) { throw new NullPointerException("Argument ctx is null."); } pkgName = AppUtils.getFullPackageName(ctx, false); uriBuilder = new Uri.Builder(); uriBuilder.scheme("market").authority("details").appendQueryParameter("id", pkgName); intent = new Intent(Intent.ACTION_VIEW, uriBuilder.build()); return intent; }