List of usage examples for android.content Intent resolveActivity
public ComponentName resolveActivity(@NonNull PackageManager pm)
From source file:com.master.metehan.filtereagle.Util.java
public static void sendCrashReport(Throwable ex, final Context context) { if (!isPlayStoreInstall(context)) return;//w w w.j a va 2s . c om if (!(Util.isDebuggable(context) || Util.getSelfVersionName(context).contains("beta"))) return; try { ApplicationErrorReport report = new ApplicationErrorReport(); report.packageName = report.processName = context.getPackageName(); report.time = System.currentTimeMillis(); report.type = ApplicationErrorReport.TYPE_CRASH; report.systemApp = false; ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo(); crash.exceptionClassName = ex.getClass().getSimpleName(); crash.exceptionMessage = ex.getMessage(); StringWriter writer = new StringWriter(); PrintWriter printer = new PrintWriter(writer); ex.printStackTrace(printer); crash.stackTrace = writer.toString(); StackTraceElement stack = ex.getStackTrace()[0]; crash.throwClassName = stack.getClassName(); crash.throwFileName = stack.getFileName(); crash.throwLineNumber = stack.getLineNumber(); crash.throwMethodName = stack.getMethodName(); report.crashInfo = crash; final Intent bug = new Intent(Intent.ACTION_APP_ERROR); bug.putExtra(Intent.EXTRA_BUG_REPORT, report); bug.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (bug.resolveActivity(context.getPackageManager()) != null) context.startActivity(bug); } catch (Throwable exex) { Log.e(TAG, exex.toString() + "\n" + Log.getStackTraceString(exex)); } }
From source file:org.alfresco.mobile.android.application.managers.DataProtectionManagerImpl.java
public void executeAction(FragmentActivity activity, int intentAction, File f) { try {/*from w ww.j a va2s . c om*/ if (intentAction == DataProtectionManager.ACTION_NONE || intentAction == 0) { return; } Intent i = createActionIntent(activity, intentAction, f); if (i.resolveActivity(activity.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(activity).showAlertCrouton(activity, activity.getString(R.string.feature_disable)); } else { activity.startActivityForResult(i, PrivateRequestCode.DECRYPTED); } } catch (ActivityNotFoundException e) { } }
From source file:disono.webmons.com.utilities.sensor.Camera.Launcher.java
public void takePicture() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (intent.resolveActivity(mActivity.getApplicationContext().getPackageManager()) != null) { mActivity.startActivityForResult(intent, REQUEST_IMAGE_CAPTURE); }/*from ww w .j av a 2 s . c om*/ }
From source file:disono.webmons.com.utilities.sensor.Camera.Launcher.java
public void takePicture(FragmentActivity fragmentActivity) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (intent.resolveActivity(mActivity.getApplicationContext().getPackageManager()) != null) { fragmentActivity.startActivityForResult(intent, REQUEST_IMAGE_CAPTURE); }/*from ww w .j av a 2 s . c o m*/ }
From source file:org.alfresco.mobile.android.application.capture.PhotoCapture.java
@Override public boolean captureData() { if (hasDevice()) { try {// w w w.j av a 2 s.co m Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (intent.resolveActivity(context.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(context).showAlertCrouton(parentActivity, context.getString(R.string.feature_disable)); return false; } File folder = parentFolder; if (folder != null) { payload = new File(folder.getPath(), createFilename("IMG_", "jpg")); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(payload)); parentActivity.startActivityForResult(intent, getRequestCode()); } else { AlfrescoNotificationManager.getInstance(parentActivity) .showLongToast(parentActivity.getString(R.string.sdinaccessible)); } } catch (Exception e) { Log.d(TAG, Log.getStackTraceString(e)); return false; } return true; } else { return false; } }
From source file:com.uwetrottmann.wpdisplay.ui.SettingsFragment.java
public void openWebPage(String url) { Uri webpage = Uri.parse(url);// ww w.j a v a2 s.c o m Intent intent = new Intent(Intent.ACTION_VIEW, webpage); if (intent.resolveActivity(getContext().getPackageManager()) != null) { startActivity(intent); } }
From source file:org.alfresco.mobile.android.application.extension.scansnap.ScanSnapManagerImpl.java
@Override public boolean hasScanSnapApplication() { try {/* w ww . j a v a 2s.com*/ Uri uri = Uri.parse("scansnap:///Scan&OutMode=3"); Intent in = new Intent(); in.setData(uri); return in.resolveActivity(appContext.getPackageManager()) != null; } catch (Exception e) { return false; } }
From source file:org.alfresco.mobile.android.application.managers.DataProtectionManagerImpl.java
public void executeAction(Fragment fragment, int intentAction, File f) { try {/*from w ww . j ava 2 s . c o m*/ if (intentAction == DataProtectionManager.ACTION_NONE || intentAction == 0) { return; } Intent i = createActionIntent(fragment.getActivity(), intentAction, f); if (i.resolveActivity(fragment.getActivity().getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(fragment.getActivity()) .showAlertCrouton(fragment.getActivity(), fragment.getString(R.string.feature_disable)); } else { fragment.startActivityForResult(i, PrivateRequestCode.DECRYPTED); } } catch (ActivityNotFoundException e) { } }
From source file:org.alfresco.mobile.android.application.capture.VideoCapture.java
@Override public boolean captureData() { if (hasDevice()) { try {/*from w w w . j av a 2s .c om*/ File folder = parentFolder; if (folder != null) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); if (intent.resolveActivity(context.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(context).showAlertCrouton(parentActivity, context.getString(R.string.feature_disable)); return false; } payload = new File(folder.getPath(), createFilename("VID", "mp4")); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(payload)); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); // Represents a limit of 300Mb intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 314572800L); parentActivity.startActivityForResult(intent, getRequestCode()); } else { AlfrescoNotificationManager.getInstance(parentActivity) .showLongToast(parentActivity.getString(R.string.sdinaccessible)); } } catch (Exception e) { Log.d(TAG, Log.getStackTraceString(e)); return false; } return true; } else { return false; } }
From source file:com.google.android.car.kitchensink.assistant.CarAssistantFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.car_assistant, container, false); mMic = (ImageView) v.findViewById(R.id.voice_button); Context context = getContext(); mMic.setOnClickListener(new View.OnClickListener() { @Override/*w ww. j av a 2s . c o m*/ public void onClick(View v) { v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); Intent intent = new Intent(); intent.setAction(getContext().getString(R.string.assistant_activity_action)); if (intent.resolveActivity(context.getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(context, "Assistant app is not available.", Toast.LENGTH_SHORT).show(); } } }); return v; }