Ett*_*ore 6 android firebase-invites
我在我的应用程序中实施了Firebase App Invite,我可以选择要邀请的朋友,但不会发送邀请.
在onActivityResult中,resultCode为3.
在我的Firebase项目设置中,我已经输入了SHA1代码(发布和调试证书).
我的活动代码:
public static final int REQUEST_INVITE = 65;
private static final String TAG = GeneralActivity.class.getSimpleName();
public void inviteFriends() {
Intent intent = new AppInviteInvitation.IntentBuilder("Invitation title")
.setMessage("Invitation message")
.setOtherPlatformsTargetApplication(AppInviteInvitation.IntentBuilder.PlatformMode.PROJECT_PLATFORM_IOS, MY_IOS_APPID)
.build();
startActivityForResult(intent, REQUEST_INVITE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_INVITE) {
if (resultCode == RESULT_OK) {
String[] ids = AppInviteInvitation.getInvitationIds(resultCode, data);
for (String id : ids) {
Log.d(TAG, "onActivityResult: sent invitation " + id);
}
} else {
Log.d(TAG, "Invitation not sent");
}
}
}
Run Code Online (Sandbox Code Playgroud)
Project Gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
Run Code Online (Sandbox Code Playgroud)
模块Gradle:
dependencies {
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-ads:9.6.1'
compile 'com.google.firebase:firebase-crash:9.6.1'
compile 'com.google.firebase:firebase-invites:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
我很抱歉我的英语不好.
为什么邀请不起作用?我该如何解决这个问题?
编辑 - 已解决
问题出在这里:
.setOtherPlatformsTargetApplication(AppInviteInvitation.IntentBuilder.PlatformMode.PROJECT_PLATFORM_IOS, MY_IOS_APPID)
Run Code Online (Sandbox Code Playgroud)
我将常量MY_IOS_APPID设置为"我的应用程序的苹果app id",
相反,它是"Firebase客户端ID"的值,以找到此值:https://stackoverflow.com/a/37966199/3645999
问题就在这里:
.setOtherPlatformsTargetApplication(AppInviteInvitation.IntentBuilder.PlatformMode.PROJECT_PLATFORM_IOS, MY_IOS_APPID)
Run Code Online (Sandbox Code Playgroud)
我将常量设置MY_IOS_APPID为“我的应用程序的苹果应用程序 ID”,
相反,它是“Firebase client id”的值,要查找此值:/sf/answers/2657633961/
此答案是作为对问题Firebase App Invite - OP Ettore Gallina根据 CC BY-SA 3.0 发送的邀请的编辑而发布的。
| 归档时间: |
|
| 查看次数: |
714 次 |
| 最近记录: |