【问题标题】:How to use Firebase Remote Config for this?如何为此使用 Firebase 远程配置?
【发布时间】:2018-03-10 01:16:20
【问题描述】:

当我需要使用 Google Firebase 远程配置方法的 Videoview URL 时,如何更改?

更多详细信息:我有一个 VideoView,它使用 URL 来显示视频或流,但我希望能够在需要时更改这些链接。无需创建新的应用程序更新!

我的活动:

package tk.protvapp.protv;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.MediaController;
import android.widget.VideoView;

public class FoxActivity extends Activity {
    VideoView myVideoView;
    View v;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_fox);

        myVideoView = (VideoView)this.findViewById(R.id.videofox1); MediaController mc = new MediaController(this); myVideoView.setMediaController(mc);
        final String urlStream = "//Search the link in remote config for paste here";
        myVideoView.start();
        myVideoView.findFocus();
        runOnUiThread(new Runnable() { @Override public void run() { myVideoView.setVideoURI(Uri.parse(urlStream)); } });
    }
    public void voltarhomefox(View v){
        Intent intent = new Intent(FoxActivity.this, HomeActivity.class);
        startActivity(intent);
    }
}

我的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:ads="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000"
    tools:context="tk.protvapp.protv.FoxActivity">


    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:onClick="voltarhomefox"
        android:text="VOLTAR" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/button2"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:id="@+id/frameLayout">

        <VideoView
            android:id="@+id/videofox1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </FrameLayout>

</RelativeLayout>

【问题讨论】:

    标签: android firebase firebase-remote-config


    【解决方案1】:

    您可以在远程配置仪表板中定义一个键 video_url = "https://foo.com/video.mp4" 并使用 getString("video_url") 方法从您的代码中获取 video_url 的值。

    【讨论】:

      猜你喜欢
      • 2017-12-10
      • 2020-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-12
      • 1970-01-01
      相关资源
      最近更新 更多