具有onRequest的Firebase函数模拟器无法在android模拟器上本地工作

时间:2020-04-24 12:57:39

标签: android firebase google-cloud-functions firebase-tools

  1. 使用functions .region(region) .https.onRequest(identify);端点在本地运行功能
  2. 在android应用中使用firebase模拟器:

    private fun useFirebaseEmulators() {
    // 10.0.2.2 is the special IP address to connect to the 'localhost' of
    // the host computer from an Android emulator.
    val settings = FirebaseFirestoreSettings.Builder()
        .setHost("10.0.2.2:8080")
        .setSslEnabled(false)
        .setPersistenceEnabled(false)
        .build()
    
    val firestore = FirebaseFirestore.getInstance()
    firestore.firestoreSettings = settings
    
    FirebaseFunctions.getInstance().useFunctionsEmulator("http://10.0.2.2:5001");
    

    }

  3. 启动android模拟器,在模拟器中从步骤1调用终结点。

  4. Firebase函数未调用

0 个答案:

没有答案