Created
November 19, 2021 21:56
-
-
Save musoftware/43602d70465da10e75bde6b48c67d5b7 to your computer and use it in GitHub Desktop.
Social Android Studio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Intent getOpenFacebookIntent(Context context) { | |
try { | |
context.getPackageManager().getPackageInfo("com.facebook.katana", 0); | |
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("fb://page/xxx")); | |
intent.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH); | |
return intent; | |
} catch (Exception unused) { | |
return new Intent("android.intent.action.VIEW", Uri.parse("https://www.facebook.com/xxx/")); | |
} | |
} | |
public static Intent getOpenTwitterIntent(Context context) { | |
try { | |
context.getPackageManager().getPackageInfo("com.twitter.android", 0); | |
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("twitter://user?user_id=USERID")); | |
intent.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH); | |
return intent; | |
} catch (Exception unused) { | |
return new Intent("android.intent.action.VIEW", Uri.parse("https://twitter.com/PROFILENAME")); | |
} | |
} | |
public static Intent getOpenInstagramIntent(Context context) { | |
try { | |
context.getPackageManager().getPackageInfo("com.instagram.android", 0); | |
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http://instagram.com/_u/xxx")); | |
intent.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH); | |
intent.setPackage("com.instagram.android"); | |
return intent; | |
} catch (Exception unused) { | |
return new Intent("android.intent.action.VIEW", Uri.parse("http://instagram.com/xxx")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment