MCPcopy Create free account
hub / github.com/comaps/comaps / openUri

Method openUri

android/app/src/main/java/app/organicmaps/util/Utils.java:207–230  ·  view source on GitHub ↗

Attempts to open a URI in another app via the system app chooser. @param context the app context @param uri the URI to open. @param failMessage string id: message to show in a toast when the system can't find an app to open with.

(@NonNull Context context, @NonNull Uri uri, @Nullable Integer failMessage)

Source from the content-addressed store, hash-verified

205 * @param failMessage string id: message to show in a toast when the system can't find an app to open with.
206 */
207 public static void openUri(@NonNull Context context, @NonNull Uri uri, @Nullable Integer failMessage)
208 {
209 final Intent intent = new Intent(Intent.ACTION_VIEW);
210 intent.setData(uri);
211 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
212 intent.addCategory(Intent.CATEGORY_BROWSABLE);
213
214 try
215 {
216 context.startActivity(intent);
217 }
218 catch (ActivityNotFoundException e)
219 {
220 if (failMessage != null)
221 Toast.makeText(context, context.getString(failMessage), Toast.LENGTH_LONG).show();
222 Logger.e(TAG, "ActivityNotFoundException", e);
223 }
224 catch (AndroidRuntimeException e)
225 {
226 Logger.e(TAG, "AndroidRuntimeException", e);
227 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
228 context.startActivity(intent);
229 }
230 }
231
232 private static boolean isHttpOrHttpsScheme(@NonNull String url)
233 {

Callers 4

onStopMethod · 0.95
onClickMethod · 0.95
loginWithBrowserMethod · 0.95
openUrlMethod · 0.95

Calls 4

eMethod · 0.95
getStringMethod · 0.80
setDataMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected