start Implicit intent and allow them to download if that external activity is not available.


  Intent intent =new Intent(Intent.ACTION_DIAL, Uri.parse(“tel:555-2368”));

  // Check if an Activity exists to perform this action.
  PackageManager pm = getPackageManager();
  ComponentName cn = intent.resolveActivity(pm);
  if (cn == null)
  { 
        // If there is no Activity available to perform the action 
       // Check to see if the Google Play Store is available. 
       Uri marketUri =      Uri.parse(“market://search?q=pname:com.myapp.packagename”); 
       Intent marketIntent = new       Intent(Intent.ACTION_VIEW).setData(marketUri);
 
        // If the Google Play Store is available, use it to download an application 
// capable of performing the required action. Otherwise, log an 
// error. 
        if (marketIntent.resolveActivity(pm) != null)   
     startActivity(marketIntent); 
else      Log.d(TAG, “Market client not available.”);
 }
else 
startActivity(intent); 

Comments

Popular Post

Implement search functionality with help of edittext, rxjava and retrofit 2 in android.

QR code scanner using Zxing library. Scanner for android

Store GPS Location in image background android.

Storing captured image or an image picked from a gallery in internal storage using file provider android.

Shortcut for android for every version, android shortcut for oreo, android shortcut for nougat.