我按照tutorial将firebase集成到我的Xamarin项目
我在将google-services.json文件添加到.csproj项目
的步骤中面临问题添加此文件并重新启动visual studio后,项目无响应并保持frizzing
经过研究后,我发现答案是 file is necessary for Xamarin projects.
所以我删除了json文件并将其替换为我的代码以启动firebase
private void ConfigureFireBase()
{
var options = new FirebaseOptions.Builder()
.SetApplicationId(GetString(Resource.String.applicationId))
.SetApiKey(GetString(Resource.String.applicationId))
//.SetDatabaseUrl("Firebase-Database-Url")
.SetGcmSenderId(GetString(Resource.String.applicationId))
.Build();
var firebaseApp = FirebaseApp.InitializeApp(this, options);
Task.Run(() =>
{
var instanceId = FirebaseInstanceId.Instance;
instanceId.DeleteInstanceId();
//Android.Util.Log.Debug("TAG", "{0} {1}", instanceId.Token, instanceId.GetToken(GetString(Resource.String.applicationId), Firebase.Messaging.FirebaseMessaging.InstanceIdScope));
});
}
但直到现在还无法收到令牌