如何在当地时间Kotlin获取当前日期(日月和年)和时间(小时,分钟和秒)?
我试过了,LocalDateTime.now()但它给了我一个错误的说法Call requires API Level 26 (curr min is 21).
我怎么能在Kotlin得到时间和约会?
该文档没有关于如何向文档添加子集合的任何示例.我知道如何将文档添加到集合以及如何将数据添加到文档,但是如何向文档添加集合(子集合)?
不应该有这样的方法:
dbRef.document("example").addCollection("subCollection")
Run Code Online (Sandbox Code Playgroud) 我有这个代码在Swift 2中正常工作.
extension PHFetchResult: Sequence {
public func makeIterator() -> NSFastEnumerationIterator {
return NSFastEnumerationIterator(self)
}
}
Run Code Online (Sandbox Code Playgroud)
自从我升级到Swift 3
泛型Objective-C类的扩展无法在运行时访问类的泛型参数
我不知道如何解决这个问题.任何帮助深表感谢!
我试图用协调器布局完成以下效果:
我花了大约30小时+尝试解决这个问题,我知道要走的路是协调器布局行为,但是我有很多错误.
这是我的xml:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.StatisticsFragment">
<!-- TODO: Update blank fragment layout -->
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light">
<android.support.design.widget.AppBarLayout
android:id="@+id/main.appbar"
android:layout_width="match_parent"
android:layout_height="137dp"
android:background="@android:color/transparent">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/main.collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<android.support.v7.widget.CardView
android:id="@+id/earningsCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/todayLabel"
android:layout_width="108dp"
android:layout_height="26dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="TODAY"
android:textAlignment="center"
android:textColor="@android:color/darker_gray"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/weekLabel"
android:layout_width="108dp"
android:layout_height="26dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="WEEK"
android:textAlignment="center"
android:textColor="@android:color/darker_gray"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent" /> …Run Code Online (Sandbox Code Playgroud) animation android kotlin material-design android-design-library
所以,我最近收到了这个警告:
存储在Firestore中的Date对象的行为将发生变化,您的应用程序可能会发生变化.要隐藏此警告并确保您的应用不会中断,您需要在调用任何其他Cloud Firestore方法之前将以下代码添加到您的应用中:
const firestore = new Firestore();
const settings = {/* your settings... */ timestampsInSnapshots: true};
firestore.settings(settings);
Run Code Online (Sandbox Code Playgroud)
通过此更改,存储在Cloud Firestore中的时间戳将作为Firebase Timestamp对象而不是系统Date对象读回.因此,您还需要更新期望日期的代码,而不是期望时间戳.例如:
// Old:
const date = snapshot.get('created_at');
// New:
const timestamp = snapshot.get('created_at');
const date = timestamp.toDate();
Run Code Online (Sandbox Code Playgroud)
启用新行为时,请审核Date的所有现有用法.在将来的版本中,行为将更改为新行为,因此如果您不按照这些步骤操作,您的应用程序可能会突然发生.
我正在尝试在我的云功能代码中的管理SDK中实现建议的更正,因为我正在做的大部分工作都在那里.
我尝试使用admin.firestore().settings({ timestampsInSnapshots: true })但得到以下警告:
admin.firestore(...).settings不是一个函数
我该如何解决?
javascript firebase google-admin-sdk google-cloud-functions google-cloud-firestore
我正在构建一个功能,允许商家设置他们的业务时间表。这种功能将变量自动改变open到true和false相应时代商家设置在一周中的每一天。因此,总共有 14 个可能的不同时间。
我正在尝试构建一个循环后台任务,使用新的 Android 架构组件库 WorkManager 来完成这样的事情。
val scheduleStartWork = PeriodicWorkRequest.Builder(ScheduleWorker::class.java, 7, TimeUnit.DAYS)
.setInputData(Data.Builder().putBoolean("isStart", true).build())
.setScheduleRequestedAt(diff_time, TimeUnit.MILLISECONDS)
.addTag(weekdays[index])
.build()
Run Code Online (Sandbox Code Playgroud)
不过,它给了我以下 APILibraryException 错误:
Builder.setScheduleRequestedAt 只能从同一个库组中调用
我的问题:
1)setScheduleRequestedAt如果我想延迟调度,这是正确的调用方法diff_time吗?
2)如果是这样,我该如何解决这个问题?
PS:diff_time是与用户设置的每一天的每个相应小时的差异,以毫秒为单位。示例:周一至周五 = 08:00,周六至周日 = 10:00。
android kotlin android-architecture-components android-workmanager
假设我有4个应用程序,iOS和Android的"Uber Clone"以及iOS和Android的"Uber Driver Clone".我为所有4个使用相同的Firebase项目,因为它们共享相同的数据库.
说到Facebook Auth,我只能向Firebase添加一个Facebook应用程序.对于每个Facebook应用程序,我只能添加一个iOS和一个Android应用程序.因此,我该如何使这项工作?
Firebasers,还有任何建议/解决方案吗?
android ios facebook-authentication firebase firebase-authentication
在iOS中,根据官方文档,没有方法可以设置电话号码验证码的超时时间(甚至不知道默认的时间)。Firebaser 能解释一下为什么会这样吗?默认超时时间是多少?如果可以的话,如何在iOS中设置呢?
另一方面,在 Android 中,一切都很好:https://firebase.google.com/docs/auth/android/phone-auth#send-a-verification-code-to-the-users-phone
iphone ios firebase firebase-authentication firebase-cloud-messaging
我有以下代码:
var config = {
apiKey: "xxxxx",
authDomain: "xxxxx",
databaseURL: "xxxxx",
projectId: "xxxxx",
storageBucket: "xxxxx",
messagingSenderId: "xxxxx"
};
firebase.initializeApp(config);
$("#loginButton").on('click', function(){
logIn($("#email").val(), $("#pwd").val());
});
$("#logoutButton").on('click', function(){
firebase.auth().signOut();
console.log("clicked logout button");
});
function logIn(email, password){
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
alert(error.message);
});
}
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
console.log("Signed in");
firebase.auth().currentUser.getIdToken(true).then(function(idToken) {
// Send token to your backend via HTTPS
// ...
console.log("Token = " + idToken);
console.log("Logged in!");
$("#loginButton").val(idToken);
$("#loginForm").submit(); …Run Code Online (Sandbox Code Playgroud) 我试图在我的DAO中执行以下查询.
@Query("SELECT * FROM objects WHERE obj_id IN :ids")
List<Object> queryObjects(List<String> ids);
Run Code Online (Sandbox Code Playgroud)
它给了我这个编译时错误:
Error: no viable alternative at input 'SELECT * FROM objects WHERE obj_id IN :ids'
Run Code Online (Sandbox Code Playgroud)
双方List<String> ids以及String... ids和Sring[] ids不工作.但是,因为我不知道我在编译时会有多少ID,所以我需要一个列表/数组而不是varargs.
如何使这个SQL查询工作?
android ×6
firebase ×5
ios ×3
kotlin ×3
java ×2
javascript ×2
android-architecture-components ×1
android-room ×1
animation ×1
datetime ×1
html ×1
iphone ×1
objective-c ×1
sql ×1
sqlite ×1
swift ×1
swift3 ×1
web ×1
xcode ×1