我正在开发一款新应用.目前我正在尝试添加依赖项
implementation 'com.google.firebase:firebase-ads:15.0.1'
Run Code Online (Sandbox Code Playgroud)
插入第38行之前:
插入第38行后:
任何想法如何最好地解决这个问题?
PS classpath'com.google.gms:google-services:4.0.1'
我在回收站视图中列出了所有媒体文件.假设媒体文件在文件夹中,那么我想在我的回收站视图中显示该文件夹.这是我列出媒体文件的代码
var projection = arrayOf(MediaStore.Video.Media.DISPLAY_NAME)
var cursor = CursorLoader(applicationContext, MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
projection, null, null, null).loadInBackground()
if (cursor != null) {
while (cursor.moveToNext()) {
val name = cursor.getString(cursor.getColumnIndex(MediaStore.Video.VideoColumns.DISPLAY_NAME))
Log.i("Main", name)
}
cursor.close()
}
Run Code Online (Sandbox Code Playgroud)
如果文件夹中存在特定媒体文件,我还如何显示该文件夹.任何帮助将不胜感激.
我正在开发Android Wear OS 2.0应用程序.每当用户从给定号码获得SMS时,手表应该开始振动,并且应该出现具有给定文本的UI,其具有停止振动的按钮.它的工作方式如下:
在SmsReciever.java我正在检查电话号码是否匹配,或者UI屏幕是否已经激活.
public class SmsReceiver extends BroadcastReceiver {
//interface
private static SmsListener mListener;
@Override
public void onReceive(Context context, Intent intent) {
Bundle data = intent.getExtras();
Object[] pdus = (Object[]) data.get("pdus");
for(int i=0;i<pdus.length;i++){
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) pdus[i], "3gpp");
String sender = smsMessage.getDisplayOriginatingAddress();
String alertPhoneNumber = "301112233";
if (sender.toLowerCase().contains(alertPhoneNumber.toLowerCase()))
{
String messageBody = smsMessage.getMessageBody();
//Pass the message text to interface
mListener.messageReceived(messageBody);
} else if (AlarmActivity.active) {
Intent intent1 = new Intent();
intent1.setClassName("hu.asd.watchtest", "hu.asd.watchtest.AlarmActivity");
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent1);
} …Run Code Online (Sandbox Code Playgroud) 我试图在我的项目中集成谷歌智能登录和短信SmsRetrieverClient.令我震惊的第一件事是,在这些功能的官方文档(https://developers.google.com/identity/sms-retriever/request#prerequisites)上,缺少必需的库.一些我如何尝试在网上找到所需的:
implementation 'com.google.android.gms:play-services-base:11.8.0'
implementation 'com.google.android.gms:play-services-identity:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:11.8.0'
Run Code Online (Sandbox Code Playgroud)
但是当我同步gradle时,一个错误即将来临.即
无法解决:play-services-auth-base-license Open File
我在google上做了很多搜索,但没有得到任何解决方案.git hub上google的示例是:https://github.com/googlesamples/android-credentials/tree/master/sms-verification/android
android resolve android-gradle-plugin play-services-auth-base-license
我需要使用Bazel下载整个GitHub存储库。因为我对这个工具还很陌生,所以我不确定如何实现。
我的主要想法是:
在downloadgithubrepo.bzl(与WORKSPACE文件一样位于项目根目录)中编写自定义存储库规则,例如:
def _impl(repository_ctx):
repository_ctx.download("url_to_zipped_github_repo", output='relative_path_to_output_file')
github = repository_rule(
implementation = _impl
Run Code Online (Sandbox Code Playgroud)
并在WORKSPACE文件中编写如下内容:
load("//:downloadgithubrepo.bzl", "github")
Run Code Online (Sandbox Code Playgroud)
并需要一个BUILD文件(也位于项目根目录)来调用构建,其内容如下:
cc_library(
name = "testrun",
srcs = "main.c",
)
Run Code Online (Sandbox Code Playgroud)
我必须添加main.c文件,否则构建会失败-这是一个问题,真正的问题是这不起作用,因为构建正在传递中,但是GitHub存储库未下载。
我完全走对了吗?有人做过这样的事吗?
android ×4
android-sms ×1
bazel ×1
firebase ×1
github ×1
kotlin ×1
mediastore ×1
play-services-auth-base-license ×1
resolve ×1
wear-os ×1