Sms Gratis Indosat

Phone Numbers
0 -
Example : 83832867987 Without 0

Type your Messages

Question: + =

Check and request to install Facebook App

Last exercise "Start facbook app by startActivity(intent)", without checking if Facebook App installed. To check if a app installed currently, we can call getPackageManager().getApplicationInfo() method; if not installed, NameNotFoundException will be thrown. To open Google Play with with a specified app, startActivity with action of Intent.ACTION_VIEW and url of the target package.

Check and request to install Facebook App


Modify btnStartFacebookOnClickListener from the last exercise:
 OnClickListener btnStartFacebookOnClickListener
= new OnClickListener(){

@Override
public void onClick(View v) {

String facebookPackageName = "com.facebook.katana";
String facebookClassName = "com.facebook.katana.LoginActivity";

try {
ApplicationInfo facebookAppInfo = getPackageManager()
.getApplicationInfo(facebookPackageName, 0);
Intent intent = new Intent("android.intent.category.LAUNCHER");
intent.setClassName(facebookPackageName, facebookClassName);
startActivity(intent);
} catch (NameNotFoundException e) {
// Didn't installed
Toast.makeText(getApplicationContext(), "Facebook not found! INSTALL.", Toast.LENGTH_LONG).show();

//Start Market to downoad and install Facebook App
Uri uri = Uri.parse("market://details?id=" + facebookPackageName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}

}};


Next:
- Launch Facebook app from a specified page, using intent with ACTION_VIEW.

Audi RS6 Avant (2013)

V8 / 3.993 cc / 560 PS / 516ft/lb (700 Nm) @ 1.750 - 5.500 / twin turbo / quattro AWD / 0 - 62 mph (100 km/h): 3,9 s / Vmax: 189 mph (305 km/h)

(click images for a larger view)














 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy