从FCM文档这里告诉我如何将消息发送到设备组,所以我要发送如下内容:
https://android.googleapis.com/gcm/notification
Content-Type:application/json
Authorization:key=API_KEY
project_id:SENDER_ID
{
"operation": "create",
"notification_key_name": "appUser-Chris",
"registration_ids": ["4", "8", "15", "16", "23", "42"]
}
Run Code Online (Sandbox Code Playgroud)
但是,我没有发现有任何明确的解释告诉我如何"registration_ids"从Firebase FCM 获取.
我只能使用"注册令牌" FirebaseInstanceId.getInstance().getToken().
所以任何人都可以告诉我如何"registration_ids"取悦?
我这里有简单的回收器视图,我想要的是:
当列表很短时:将按钮粘贴在回收器视图下方
当列表很长时:将按钮粘在屏幕底部,但回收器视图正确换行并且能够滚动到底部
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_user_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="20dp"
app:layout_constraintBottom_toTopOf="@id/btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintVertical_bias="0.0"
tools:itemCount="50"/>
<Button
android:id="@+id/btn"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:text="example"
android:background="#00ffff"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/rv_user_address"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
什么时候wrap_content:
<androidx.recyclerview.widget.RecyclerView
android:layout_height="wrap_content"
...
Run Code Online (Sandbox Code Playgroud)
短列表可以正确地将按钮粘贴在下面,但当列表很长时按钮会离开屏幕
什么时候是约束:0dp:
<androidx.recyclerview.widget.RecyclerView
android:layout_height="0dp"
...
Run Code Online (Sandbox Code Playgroud)
长列表是正确的行为,但短列表不能将按钮粘贴在列表下方
我不知道了。谢谢你的帮助。
我无法执行我的 android espresso 单元测试并且它失败了:
// (kotlin syntax)
closeSoftKeyboard()
onView(withId(R.id.et_login_mobile_number)).perform(TypeTextAction(invalidMobileNo))
closeSoftKeyboard()
Run Code Online (Sandbox Code Playgroud)
androidx.test.espresso.InjectEventSecurityException:java.lang.SecurityException:注入另一个应用程序需要 INJECT_EVENTS 权限。
我终于了解到:在进行自动化测试的 UI 上出现的任何意外动画都可能会中断该过程。
所以我怀疑这是由于谷歌密码管理器提示保存的密码列表不断弹出,这可能是导致中断的原因。
我现在正在寻找的是:从建议保存的密码中关闭谷歌密码管理器的方式
我一直发现的是
并且无法关闭/禁用它
在我从 Google 密码管理器中删除所有保存的密码之后,现在它出现了建议自动填充文本(请比较两个屏幕截图)
我已经包含了如下属性,它仍然不会阻止自动填充到 Android 8 及更高版本的设备。
android:inputType="number|textNoSuggestions|textFilter"
Run Code Online (Sandbox Code Playgroud)
passwords android autocompletetextview android-layout android-espresso