ปรับแต่งหน้าจอยินดีต้อนรับกลับมา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เนื้อหาที่ปรับเปลี่ยนในแบบของคุณจะช่วยให้ผู้ใช้พึงพอใจและมอบประสบการณ์จาก
การโต้ตอบแรกกับแอปตามค่ากำหนด ประวัติการใช้งาน
และภาษา Firebase ให้คุณกำหนดกลุ่มเป้าหมายตาม
Google Analytics เมตริกและปรับแต่งแอปพลิเคชันด้วย
Firebase Remote Config จากคอนโซล Firebase โดยตรง
เมื่อใช้ฟีเจอร์ทั้ง 2 อย่างนี้ร่วมกัน คุณจะปรับแต่งต้อนรับแอปกลับมาได้
หน้าจอสำหรับผู้ใช้ที่ซ้ำโดยอิงตามค่ากำหนดหรือกิจกรรมในแอป
คู่มือนี้จะแนะนําขั้นตอนการสร้างคอนเทนต์ในแบบของคุณเอง
"ยินดีต้อนรับกลับมา" หน้าจอบน Android
ในการเริ่มต้นใช้งาน คุณต้องมีแอป Android ที่เชื่อมต่อกับโปรเจ็กต์ Firebase ถ้า
หากยังไม่มีบัญชี โปรดดูเริ่มต้นใช้งานสำหรับ Android
เพื่อเชื่อมต่อแอปของคุณ
ภาพรวมการใช้งาน
การใช้งานหน้าจอต้อนรับที่ปรับเปลี่ยนในแบบของคุณของแอปมี 3 ขั้นตอนกว้างๆ ดังนี้
- ตั้งค่า Remote Config เพื่อเก็บพารามิเตอร์สำหรับองค์ประกอบที่จะ
ที่ปรับเปลี่ยนในแบบของคุณ ตัวอย่างเช่น คุณอาจจัดเก็บข้อความบนหน้าจอต้อนรับเป็น
พารามิเตอร์ วิธีนี้ช่วยให้คุณอัปเดตข้อความได้โดยไม่ต้องเผยแพร่แอปอีกครั้ง
- ตั้งค่า Analytics เพื่อกําหนดกลุ่มเป้าหมายและ/หรือพร็อพเพอร์ตี้ผู้ใช้สําหรับ
Remote Config เพื่อกำหนดเป้าหมายผู้ใช้ ทั้ง 2 ฟีเจอร์ใช้ได้กับ
การกำหนดเป้าหมาย อย่างไรก็ตาม มีความแตกต่างที่สำคัญระหว่างเนื้อหาทั้งสอง
ซึ่งเราจะกล่าวถึงข้อดีของแต่ละฟีเจอร์ในช่วงท้ายของคู่มือนี้
- กําหนดค่าเงื่อนไข Remote Config รายการเพื่อปรับแต่งพารามิเตอร์ตาม
กลุ่มเป้าหมายหรือพร็อพเพอร์ตี้ผู้ใช้ Analytics ที่คุณตั้งค่าไว้
ตั้งค่าพารามิเตอร์ใน Remote Config
เมื่อระบุองค์ประกอบของแอปที่ต้องการปรับแต่งแล้ว ให้ใช้
Remote Config เพื่อจัดเก็บพารามิเตอร์ เราจะสำรวจการปรับเปลี่ยนข้อความต้อนรับในแบบของคุณ
บนหน้าจอส่วนที่เหลือของคู่มือนี้
สิ่งที่ต้องทำในคอนโซล Firebase
- ไปที่พารามิเตอร์ Remote Config
ในคอนโซล Firebase ถ้า
คุณไม่เคยกำหนดค่า Remote Config ในแอป ให้คลิกเพิ่มรายการแรก
พารามิเตอร์
กรอกคีย์พารามิเตอร์และค่าเริ่มต้น เช่น welcome_message
และ Welcome to this sample app
การกำหนดค่าพารามิเตอร์การกำหนดค่าระยะไกล">
คลิกนำการเปลี่ยนแปลงไปใช้จริง
สิ่งที่ต้องทำในแอป Android
เพิ่มโค้ดเพื่ออ่านและแสดงพารามิเตอร์ที่คุณเพิ่งเพิ่มลงในแอปใน
คอนโซล Firebase เช่น
final FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
config.getInstance.fetch(CACHE_EXPIRATION_MS)
.addOnCompleteListener(this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
config.activateFetched();
String welcomeMessage = config.getString("welcome_message");
}
}
});
คุณยังทำตามขั้นตอนใน
ใช้ Firebase Remote Config บน Android
เพื่ออ่านและแสดงพารามิเตอร์ที่คุณสร้างไว้ในคอนโซล หากได้รับ
ต่อไป คำแนะนำแบบทีละขั้นของ Android จะแนะนำคุณ
ผ่านตัวอย่างการใช้งานแอป
เปิด
โหมดนักพัฒนาซอฟต์แวร์
เพื่อดูการเปลี่ยนแปลงการกำหนดค่าทันทีขณะทดสอบ
ทดสอบว่าใช้งานได้
- เปิดแอปและตรวจสอบว่าแอปแสดงค่าปัจจุบันของพารามิเตอร์
ใน Remote Config UI
- เปลี่ยนค่าในคอนโซลแล้วคลิกเผยแพร่การเปลี่ยนแปลง
- รีสตาร์ทแอป ค่าพารามิเตอร์ใหม่ควรจะปรากฏ
ตั้งค่ากลุ่มเป้าหมายหรือพร็อพเพอร์ตี้ผู้ใช้ Analytics รายการ
ในขั้นตอนนี้ คุณจะใช้ Analytics เพื่อกำหนดผู้ใช้ที่ควรดู
ที่ปรับเปลี่ยนในแบบของคุณ ในคำแนะนำแบบทีละขั้นนี้ เราจะใช้พร็อพเพอร์ตี้ผู้ใช้ในการดำเนินการ
แต่คุณก็สามารถกำหนด
ผู้ชม
วิธีการเหล่านี้จะคล้ายกัน แต่คุณควรทราบว่าเมื่อมีการเพิ่มผู้ใช้แล้ว
แก่ผู้ชม พวกเขาจะไม่สามารถปล่อยไว้หรือนำออกได้ หากแอตทริบิวต์ที่คุณต้องการสร้าง
การใช้เพื่อกำหนดเป้าหมายอาจเปลี่ยนแปลงได้ ให้ใช้พร็อพเพอร์ตี้ผู้ใช้แทน
สิ่งที่ต้องทำในคอนโซล Firebase
- ไปที่พร็อพเพอร์ตี้ผู้ใช้ Analytics
ในคอนโซล Firebase คลิกพร็อพเพอร์ตี้ผู้ใช้ใหม่
ตั้งชื่อและใส่คําอธิบายให้กับพร็อพเพอร์ตี้ผู้ใช้ ตัวอย่างเช่น ถ้าคุณคือ
คุณอาจปรับแต่งแอปตามว่าผู้ใช้ชอบสุนัขหรือแมว
ตั้งชื่อว่า animal_preference
การกำหนดค่าพร็อพเพอร์ตี้ผู้ใช้ของ Analytics">
คลิกสร้าง
สิ่งที่ต้องทำในแอป Android
- ทำตามขั้นตอนในหัวข้อตั้งค่าพร็อพเพอร์ตี้ผู้ใช้
ดูวิธีตั้งค่าพร็อพเพอร์ตี้ผู้ใช้ในแอปพลิเคชัน ตัวอย่างเช่น คุณสามารถ
อาจถามผู้ใช้ว่าชอบแมวหรือสุนัขมากกว่า แล้วตั้งค่าสตริง
ตามนั้น คุณข้ามขั้นตอนการลงทะเบียนพร็อพเพอร์ตี้ใน
คอนโซลเหมือนกับที่คุณได้ดำเนินการไปแล้วในส่วนก่อนหน้านี้
- ทำตามขั้นตอนในเหตุการณ์การแก้ไขข้อบกพร่องเพื่อเปิดใช้
โหมดแก้ไขข้อบกพร่องของแอป
ทดสอบว่าใช้งานได้
- เปิดแอปและไปที่การตั้งค่าพร็อพเพอร์ตี้ผู้ใช้
- เปิดหน้า Analytics DebugView
ในคอนโซล Firebase
- ดูว่ามีการตั้งค่าพร็อพเพอร์ตี้ผู้ใช้หรือไม่ (อาจมี
อาจเกิดความล่าช้า 2-3 นาทีก่อนที่สิ่งต่างๆ จะปรากฏขึ้น)
เมื่อแอปมีพารามิเตอร์ที่กำหนดค่าได้และพร็อพเพอร์ตี้ผู้ใช้แล้ว
(หรือกลุ่มเป้าหมาย) เพื่อใช้เป็นตัวแปร คุณสามารถสร้างเงื่อนไขเพื่อปรับเปลี่ยนในแบบของคุณ
ค่าของพารามิเตอร์
สิ่งที่ต้องทำในคอนโซล Firebase
- ไปที่ Remote Config
ในคอนโซล Firebase
- คลิกพารามิเตอร์เพื่อแก้ไข
- คลิกเพิ่มค่าสำหรับเงื่อนไข
- เลือกกำหนดเงื่อนไขใหม่
- ตั้งชื่อเงื่อนไข เช่น "ชอบแมว" ให้สะท้อนผู้ใช้
ที่ต้องการจากก่อนหน้านี้
ในส่วนใช้ในกรณีที่ ให้เลือกพร็อพเพอร์ตี้ผู้ใช้ (หรือผู้ใช้ในกลุ่มเป้าหมาย หาก
คุณสร้างกลุ่มเป้าหมายใน Analytics) แล้วเลือกพารามิเตอร์ และ
กำหนดความสัมพันธ์แบบมีเงื่อนไขกับค่าพารามิเตอร์
เงื่อนไขการกำหนดค่าระยะไกล">
คลิกสร้างเงื่อนไข
ป้อนค่าเพื่อให้สอดคล้องกับเงื่อนไขใหม่ เช่น ข้อความต้อนรับ
สำหรับ "ชอบแมว" อาจจะเป็น "แมว!"
คลิกอัปเดตเพื่อบันทึกการเปลี่ยนแปลง
คลิกเผยแพร่การเปลี่ยนแปลงเพื่อเปิดใช้เงื่อนไขและค่าใหม่ในบัญชี
แอป
ทดสอบว่าใช้งานได้
- เปิดแอปและไปที่การตั้งค่าพร็อพเพอร์ตี้ผู้ใช้
- เปิดหน้า Analytics DebugView
ในคอนโซล Firebase
- ดูว่ามีการตั้งค่าพร็อพเพอร์ตี้ผู้ใช้หรือไม่ (อาจมี
อาจเกิดความล่าช้า 2-3 นาทีก่อนที่สิ่งต่างๆ จะปรากฏขึ้น)
- รีสตาร์ทแอปและยืนยันว่าได้ตั้งค่าองค์ประกอบที่ปรับเปลี่ยนในแบบของคุณแล้ว
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-09-04 UTC
[null,null,["อัปเดตล่าสุด 2025-09-04 UTC"],[],[],null,["Personalized content can delight your users and provide an experience from the\nvery first interaction with your app based on their preferences, usage history,\nand locale. Firebase allows you to define audiences based on\nGoogle Analytics metrics and customize your application with\nFirebase Remote Config directly from the Firebase console.\n\nUsing these two features together, you can customize your app's welcome back\nscreen for a repeat user based on their preferences or activity in your app.\n\nThis guide walks you through the process to create your own personalized\n\"welcome back\" screen on Android.\n\nTo get started, you'll need an Android app connected to a Firebase project. If\nyou don't already have one, see [Get started for Android](/docs/android/setup)\nto connect your app.\n\nImplementation overview\n\nImplementing your app's personalized welcome screen consists of 3 broad steps:\n\n1. **Set up Remote Config to hold parameters for the elements to be\n personalized.** For example, you might store the welcome screen message as a parameter. This way you can update the message without republishing your app.\n2. **Set up Analytics to define audiences and/or user properties for\n Remote Config to target your users.** Both features can be used for targeting; however, there are important differences between them. The relative advantages of each are discussed later in this guide.\n3. **Configure Remote Config conditions to customize your parameter based on\n the Analytics audiences or user properties you set up.**\n\nSet up parameters in Remote Config\n\nOnce you identify the elements of your app you want to customize, use\nRemote Config to store parameters. We'll explore personalizing the welcome\nscreen message in the rest of this guide.\n\nWhat to do in the Firebase console\n\n1. Go to the [Remote Config parameter](https://console.firebase.google.com/project/_/config) page in the Firebase console. If you've never configured Remote Config in your app, click **Add Your First\n Parameter**.\n2. Fill out a parameter key and default value. For example, `welcome_message`\n and `Welcome to this sample app`.\n\n Remote Config parameter configuration.\"\\\u003e\n3. Click **Publish Changes**.\n\nWhat to do in the Android app\n\n1. Add code to read and display the parameter you just added to your app in the\n Firebase console. For example:\n\n final FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();\n config.getInstance.fetch(CACHE_EXPIRATION_MS)\n .addOnCompleteListener(this, new OnCompleteListener\u003cVoid\u003e() {\n @Override\n public void onComplete(@NonNull Task\u003cVoid\u003e task) {\n if (task.isSuccessful()) {\n config.activateFetched();\n\n String welcomeMessage = config.getString(\"welcome_message\");\n }\n }\n });\n\n You can also follow the steps in\n [Use Firebase Remote Config on Android](/docs/remote-config/get-started?platform=android)\n to read and display the parameter that you created in the console. If you get\n stuck, the [Android walkthrough](/docs/remote-config/android) guides you\n through the working sample app implementation.\n2. Turn on\n [developer mode](/docs/reference/android/com/google/firebase/remoteconfig/FirebaseRemoteConfigSettings.Builder#setDeveloperModeEnabled(boolean))\n to see config changes immediately while testing.\n\nTest that it works\n\n1. Open your app and make sure that it shows the current value of the parameter in the [Remote Config UI](https://console.firebase.google.com/project/_/config).\n2. Change the value in the console and click **Publish Changes**\n3. Restart your app. The new parameter value should be shown.\n\nSet up Analytics audiences or user properties\n\nIn this step you'll use Analytics to define the users who should see\npersonalized content. In this walkthrough, we'll use a user property to do this\nbut you could also define an\n[Audience](//support.google.com/firebase/answer/6317509?hl=en&ref_topic=6317489).\nThese approaches are similar, but you should be aware that once a user is added\nto an Audience, they cannot leave it or be removed. If the attribute you want to\nuse for targeting could change, use a user property instead.\n\nWhat to do in the Firebase console\n\n1. Go to the [Analytics user property](https://console.firebase.google.com/project/_/analytics/userproperty) page in the Firebase console. Click **New User Property**.\n2. Give the user property a name and description. For example, if you were\n customizing an app based on whether a user prefers dogs or cats, you might\n name it `animal_preference`.\n\n Analytics user property configuration.\"\\\u003e\n3. Click **Create**.\n\nWhat to do in the Android app\n\n1. Follow the steps in [Set User Properties](/docs/analytics/android/properties#set_user_properties) to learn to set your user property in your application. For example, you might ask a user if they prefer cats or dogs and set a string value accordingly. You can skip over the steps to register your property in the console as you've already done that in the previous section.\n2. Follow the steps in [Debugging Events](/docs/analytics/debugview) to enable debug mode for your app.\n\nTest that it works\n\n1. Open your app and navigate to where your user property is set.\n2. Open the [Analytics DebugView page](https://console.firebase.google.com/project/_/analytics/debugview) in the Firebase console.\n3. Look to see if any user properties have been set (there might be a few minutes of delay before anything shows up).\n\nConfigure Remote Config conditions\n\nNow that your app has parameters that can be configured, and user properties\n(or audiences) to use as variables, you can create conditions to personalize\nthe values of your parameters.\n\nWhat to do in the Firebase console\n\n1. Go to [Remote Config](https://console.firebase.google.com/project/_/config) in the Firebase console.\n2. Click your parameter to edit it.\n3. Click **Add value for condition**.\n4. Select **Define new condition**.\n5. Give your condition a name. For example, \"Prefers cats\" to reflect the user preference from earlier.\n6. Under **Applies if** , select **User property** (or **User in audience** if\n you created an Audience in Analytics), and select your parameter, and\n define a conditional relationship with your parameter values.\n\n Remote Config condition.\"\\\u003e\n7. Click **Create condition**.\n\n8. Enter a value to reflect the new condition. For example, the welcome message\n for \"Prefers cats\" could be \"Meow!\".\n\n9. Click **Update** to save your changes.\n\n10. Click **Publish Changes** to enable the new conditions and values in your\n app.\n\nTest that it works\n\n1. Open your app and navigate to where your user property is set.\n2. Open the [Analytics DebugView page](https://console.firebase.google.com/project/_/analytics/debugview) in the Firebase console.\n3. Look to see if any user properties have been set (there might be a few minutes of delay before anything shows up).\n4. Restart your app and verify that your personalized elements have been set."]]