我使用Firebase Console发送数据类型的推送通知,效果很好。但是现在我有一个条款和条件活动,如果用户不接受"条款和条件"(它存储在共享首选项中,作为布尔值(,我想禁用Firebase服务。
我在 Stackoverflow 上找到了一个解决方案,但它对我不起作用,如果我从 Firebase 控制台发送通知,我仍然会收到消息。
<service android:name=".MyFirebaseMessagingService"
android:enabled="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name=".MyFirebaseIntanceIDService">
<intent-filter>
android:enabled="false">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
您可以在
屏幕上设置一个复选框,并在选中该复选框时设置按钮单击的条件,然后转到流,否则向用户显示 Toast 或对话框"您必须接受条款和条件",如下所示:-
if (land_chack.isChecked()) {
// do your stuff here in accept your terms and conditions
} else {
Toast.makeText(LandingPage.this, "Please check terms and conditions", Toast.LENGTH_SHORT).show();
}