小编Bik*_*ken的帖子

将aws后端连接到firebase数据库

我目前正在我的 aws 服务器中运行 python 代码,并尝试连接到我朋友的 firebase 数据库。我阅读了 firebase 提供的文档来连接到 aws 服务器。

https://firebase.google.com/docs/admin/setup

我已遵循每个步骤,但当我尝试连接到我的服务器时出现错误。我添加了 google-service.json 作为凭据。我得到的错误:

ValueError:服务帐户证书无效。证书必须包含设置为“service_account”的“类型”字段。

我需要修改google-services.json吗?

我的代码:

import firebase_admin
from firebase_admin import credentials


cred = credentials.Certificate('/home/ec2-user/google-services.json')
#default_app = firebase_admin.initialize_app(cred)
other_app = firebase_admin.initialize_app(cred, name='other')
ault_app = firebase_admin.initialize_app()
Run Code Online (Sandbox Code Playgroud)

python amazon-web-services firebase

2
推荐指数
1
解决办法
5331
查看次数

如何在android中播放资源目录中的音频文件

我无法播放 2 秒的小音频剪辑。我已经尝试了 stackOverflow 中提到的与此问题类似的每个排列。即使是似乎对其他人有用的解决方案,也没有任何东西对我有用。我不知道是因为我没有物理设备可以测试还是其他什么原因。

我收到“找不到活动”错误:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.category.ACTION_VIEW dat=R.raw.song_name.mp3 }
Run Code Online (Sandbox Code Playgroud)

我的播放音频的代码:

Uri uri = Uri.parse("R.raw.song_name.mp3");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType("audio/*");
intent.setData(uri);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

我的文件存储在:

res/raw/song_name.mp3

我没有对 AndroidManifest.xml 做任何额外的事情。我正在模拟器上运行这个应用程序。这是导致此错误的原因吗?

audio android audio-streaming avaudioplayer

1
推荐指数
1
解决办法
5624
查看次数