本文整理汇总了Java中com.facebook.share.model.AppInviteContent类的典型用法代码示例。如果您正苦于以下问题:Java AppInviteContent类的具体用法?Java AppInviteContent怎么用?Java AppInviteContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AppInviteContent类属于com.facebook.share.model包,在下文中一共展示了AppInviteContent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAppCall
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
@Override
public AppCall createAppCall(final AppInviteContent content) {
final AppCall appCall = createBaseAppCall();
DialogPresenter.setupAppCallForNativeDialog(
appCall,
new DialogPresenter.ParameterProvider() {
@Override
public Bundle getParameters() {
return createParameters(content);
}
@Override
public Bundle getLegacyParameters() {
// App Invites are not supported with legacy fb4a devices.
// We should never get here
Log.e(TAG, "Attempting to present the AppInviteDialog with " +
"an outdated Facebook app on the device");
return new Bundle();
}
},
getFeature());
return appCall;
}
示例2: createParameters
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
private static Bundle createParameters(final AppInviteContent content) {
Bundle params = new Bundle();
params.putString(ShareConstants.APPLINK_URL, content.getApplinkUrl());
params.putString(ShareConstants.PREVIEW_IMAGE_URL, content.getPreviewImageUrl());
return params;
}
示例3: appInviteFacebook
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
private void appInviteFacebook() {
String appLinkUrl, previewImageUrl;
Context context = ActivityMain.this;
//appLinkUrl = "https://play.google.com/store/apps/details?id=" + context.getPackageName();
appLinkUrl = context.getString(R.string.facebook_app_url);
previewImageUrl = "http://protoolapps.com/static/media/uploads/protoolapps.com/playstore-icon.png";
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
AppInviteDialog.show(this, content);
}
}
示例4: presentChannelInterface
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
@Override
public void presentChannelInterface(InviteChannel inviteChannel, InvitePackage invitePackage, final InviteCallback callback) {
if (isConnected()) {
AppInviteContent.Builder contentBuilder = new AppInviteContent.Builder();
contentBuilder.setApplinkUrl(invitePackage.getReferralUrl());
if (invitePackage.getImageUrl() != null && invitePackage.getImage() != null) {
contentBuilder.setPreviewImageUrl(invitePackage.getImageUrl());
}
AppInviteContent sharedContent = contentBuilder.build();
AppInviteDialog appInviteDialog = new AppInviteDialog(_activity);
appInviteDialog.registerCallback(_callbackManager, new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
callback.onComplete();
}
@Override
public void onCancel() {
callback.onCancel();
}
@Override
public void onError(FacebookException facebookException) {
callback.onError(facebookException);
}
}
);
appInviteDialog.show(sharedContent);
} else {
onError("Can't reach Facebook. No internet connection.", callback);
}
}
示例5: canShow
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
@Override
public boolean canShow(AppInviteContent content) {
return AppInviteDialog.canShowNativeDialog();
}
示例6: onCreate
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
sharedPreferences = getSharedPreferences("MOVEALARM_PREFERENCE", Context.MODE_PRIVATE);
super.onCreate(savedInstanceState);
usermanagemnent = UserManagement.instance();
if(UserManagement.instance().wantLogout){
LoginManager.getInstance().logOut();
UserManagement.instance().userlogout();
}
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
setContentView(R.layout.activity_login);
if (FriendManagement.wantmorefriend) {
FriendManagement.wantmorefriend = false;
String appLinkUrl, previewImageUrl;
appLinkUrl = "https://fb.me/888833747879377";
previewImageUrl = "blob:https%3A//drive.google.com/a0c8eb9e-ba93-4ab1-a39d-4e0520e29df0";
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
AppInviteDialog.show(this, content);
}
finish();
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
progressBar = (ProgressBar)findViewById(R.id.progressbar);
guest = (ImageView)findViewById(R.id.guest);
fake = (ImageView)findViewById(R.id.fake);
progressBar.setVisibility(View.GONE);
loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setReadPermissions(Arrays.asList("user_birthday, public_profile, email, user_friends, read_custom_friendlists"));
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
user_id = loginResult.getAccessToken().getUserId();
Log.i("USER ID", user_id);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("facebook_id", user_id);
editor.commit();
if (loginResult.getAccessToken() != null) {
Set<String> deniedPermissions = loginResult.getRecentlyDeniedPermissions();
}
progressBar.setVisibility(View.VISIBLE);
guest.setClickable(false);
loginButton.setClickable(false);
fake.setBackgroundColor(Color.parseColor("#70000000"));
setUserInfo();
}
@Override
public void onCancel() {
Log.i("TAG2", "cancel");
info.setText("Login attempt cancelled.");
}
@Override
public void onError(FacebookException e) {
Log.i("TAG2", "error");
info.setText("Login attempt failed.");
}
});
}
示例7: inviteFriends
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
@Override
public void inviteFriends(String appLinkUrl, String previewImageUrl, final Callback cb) {
if (AndroidNativeUtil.getActivity() == null) {
throw new RuntimeException("Cannot invite friends while running in the background.");
}
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
final CodenameOneActivity activity = (CodenameOneActivity) AndroidNativeUtil.getActivity();
if(cb == null){
AppInviteDialog.show(activity, content);
}else{
AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
final CallbackManager mCallbackManager = CallbackManager.Factory.create();
activity.setIntentResultListener(new IntentResultListener() {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
mCallbackManager.onActivityResult(requestCode, resultCode, data);
activity.restoreIntentResultListener();
}
});
appInviteDialog.registerCallback(mCallbackManager, new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
cb.onSucess(null);
}
});
}
@Override
public void onCancel() {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
cb.onError(null, null, -1, "User Cancelled");
}
});
}
@Override
public void onError(final FacebookException e) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
cb.onError(null, e, 0, e.getMessage());
}
});
}
});
appInviteDialog.show(content);
}
}
}
示例8: show
import com.facebook.share.model.AppInviteContent; //导入依赖的package包/类
/**
* Helper to show the provided {@link com.facebook.share.model.AppInviteContent} using
* the provided Activity. No callback will be invoked.
*
* @param activity Activity to use to share the provided content
* @param appInviteContent Content of the app invite to send
*/
public static void show(
final Activity activity,
final AppInviteContent appInviteContent) {
new AppInviteDialog(activity)
.show(appInviteContent);
}