因此,我正在使我的应用程序与Oreo兼容并面临通知问题.
我根据文档添加了通知频道,除了通知在每个帖子上发出声音之外,一切都工作顺利,尝试将默认值设置为0.
我正在模拟器中测试我的应用程序,非常感谢任何帮助.
使用此代码创建频道
NotificationCompat.Builder builder = new NotificationCompat.Builder(PlayerService.this, "channel_01")
.setAutoCancel(false)
.setContentIntent(pendingIntent)
.setContent(viewsSmall)
.setCustomBigContentView(viewsExpanded)
.setDeleteIntent(pSwipeToDismiss);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setVisibility(Notification.VISIBILITY_PUBLIC);
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
builder.setPriority(Notification.PRIORITY_MAX);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
/* Create or update. */
NotificationChannel channel = new NotificationChannel("channel_01",
"Playback Notification",
NotificationManager.IMPORTANCE_DEFAULT);
mNotificationManager.createNotificationChannel(channel);
mBuilder.setChannelId("channel_01");
}
final Notification notification = builder.build();
startForeground(Constants.NOTIFICATION_ID.FOREGROUND_SERVICE,notification);
Run Code Online (Sandbox Code Playgroud) 我们最近启用了用于读取用户 YouTube 频道 ID 的 YouTube 数据 API。在我们创建的测试项目中一切正常。
现在我们请求访问我们生产项目的 YouTube 范围,并获得了谷歌的批准。
但是当我们尝试使用该项目时,我们收到了这个错误。
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. YouTube Data API has not been used in project 123 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=123 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=123" } ], "code": 403, "message": "Access Not Configured. YouTube Data API has not been used …Run Code Online (Sandbox Code Playgroud) android sha1 youtube-api android-youtube-api google-developers-console
我试图在无状态小部件中使用TextFormField以及ScopedModel来处理其中的文本并面临如下的各种问题.
我尝试使用控制器进行字段,但每次我输入一些文本并在键盘上按完,文本就会被清除.不知道为什么.
如果我删除控制器,文本将保留在字段中,但会创建有关如何从字段获取文本的新问题.我通过使用回调onFieldSubmitted来解决它.
但结果是,当我们点击键盘上的完成按钮时,onFieldSubmitted才被调用.如果我在字段中输入文本而不是单击确定,单击另一个字段,将不会调用回调,我将无法跟踪用户在字段中输入的内容.
对此有何解决方案?
附加问题的示例代码.
class LoginPageStateless extends StatelessWidget {
final loginUsernameController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: true,
body: ScopedModelDescendant<AccountModel>(
builder: (context, child, model) {
return Form(
//key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextFormField(
style: TextStyle(fontSize: 15.0),
decoration: InputDecoration(
labelText: 'Email id',
hintText: 'johndoe@ipropal.com',
),
controller: loginUsernameController,
onFieldSubmitted: model.updateLoginUsernameText,
),
TextFormField(
style: TextStyle(fontSize: 15.0),
decoration: InputDecoration(
labelText: 'Password',
),
controller: loginUsernameController,
onFieldSubmitted: model.updateLoginUsernameText,
obscureText: true,
),
],
), …Run Code Online (Sandbox Code Playgroud) 我正在使用带有 Gradle 3.1.3 的 Android Studio 3.1.3(撰写本文时的最新版本)。
不知道这是否重要,但我最近升级到 Ubuntu 18.04
每当我启动 Android Studio 时,它的内存占用都非常小。(名为 java 的单个进程需要大约 1GB 的 RAM)
现在,当我开始构建过程时,又一个 java 进程开始运行,占用大约 500MB 的 RAM。仍然没有问题,因为我有 8GB 的 RAM。
使用 Studio 大约一两个小时后(包括我在真实设备上测试的构建数量),突然计算机死机,三个 java 进程占用了近 5GB 的 RAM(每个大约 2.3、1.5 和 1.2 GB)。即使工作室空闲,这些进程也不会释放内存。我必须退出工作室并重新启动它才能让它消失。
这是我的系统监视器窗口的屏幕截图。
下面是每个过程的描述。
还有其他人面临这个问题吗?当我在 Ubuntu 16.04 和旧的 android studio 中时,这不是问题。Ubuntu 是否必须对它做任何事情?
给出以下命令时出现以下错误。
aws ecr get-login --region eu-central-1
Run Code Online (Sandbox Code Playgroud)
错误
An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws:iam::314xxxx91079:user/git is not authorized to perform: ecr:GetAuthorizationToken on resource: *
Run Code Online (Sandbox Code Playgroud)
我的管理员已授予我访问此“GetAuthorizationToken”资源的权限。
很可能我认为问题是用于此命令的 'arn:aws:iam::314xxxx91079:user/git' 用户。当我登录到 aws 控制台时,我看到我的用户名 (IAM) 如下。
amit@iproxxx.com
Run Code Online (Sandbox Code Playgroud)
我如何让 'get-login' 使用这个用户名而不是 user/git。我对 aws cli 很陌生,这个命令恰好是构建步骤之一。
我一直在研究 Android 中新架构组件中引入的 Room DB,并考虑将我当前的 DB 迁移到 Room DB。
但是我当前的 db 实现允许我向表中添加列,但根据 Room,POJO 类中的字段表示表的列。
可以使用原始查询在 Room DB 中添加列,如果是,我将如何实现它。
我正在尝试根据用户在首选项中选择的主要颜色对可绘制对象应用滤色器。这是我正在使用的一段代码。
getResources().getDrawable(R.drawable.ic_batman_1)
.setColorFilter(ColorHelper.getPrimaryColor(), PorterDuff.Mode.OVERLAY);
Run Code Online (Sandbox Code Playgroud)
问题是,有时,这段代码并没有改变 drawable 的颜色过滤器。我已将此代码放在我的活动(主要活动)的 onCreate 和 onResume 方法中。
因此,一旦应用程序启动,我希望将此颜色过滤器应用于该可绘制对象,但有时不会发生。我还注意到这个问题不会发生在高端手机(高速处理器、更多内存)上,而只发生在低端手机上。
但是,如果我浏览任何其他活动并返回主活动,则会应用滤色器。调试代码并在使用正确的颜色参数启动时调用 setColorFilter,但由于某种原因它没有得到应用。任何形式的帮助表示赞赏。
请不要贬低这个问题,如果您认为这是一个愚蠢的问题,请发表评论,我会撤下这个问题。我即将被禁止在 SO 上提问。
android ×6
java ×2
android-room ×1
architecture ×1
aws-cli ×1
aws-ecr ×1
aws-lambda ×1
colorfilter ×1
drawable ×1
flutter ×1
ios ×1
lifecycle ×1
sha1 ×1
ubuntu ×1
youtube-api ×1