我正在尝试启动前台服务.我收到通知,该服务确实启动但通知始终被抑制.我仔细检查了应用是否允许在我的设备上的应用信息中显示通知.这是我的代码:
private void showNotification() {
Intent notificationIntent = new Intent(this, MainActivity.class);
notificationIntent.setAction(Constants.ACTION.MAIN_ACTION);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
Bitmap icon = BitmapFactory.decodeResource(getResources(),
R.mipmap.ic_launcher);
Notification notification = new NotificationCompat.Builder(getApplicationContext())
.setContentTitle("Revel Is Running")
.setTicker("Revel Is Running")
.setContentText("Click to stop")
.setSmallIcon(R.mipmap.ic_launcher)
//.setLargeIcon(Bitmap.createScaledBitmap(icon, 128, 128, false))
.setContentIntent(pendingIntent)
.setOngoing(true).build();
startForeground(Constants.FOREGROUND_SERVICE,
notification);
Log.e(TAG,"notification shown");
}
Run Code Online (Sandbox Code Playgroud)
这是我在关系中看到的唯一错误:
06-20 12:26:43.635 895-930/? E/NotificationService: Suppressing notification from the package by user request.
我正在尝试在后台监视用户磁盘上的文件夹,就像你可以使用JobScheduler
和监视库更改一样contentobserver
.我想为任何指定的目录执行此操作.但是,当目录有任何文件更改时,我无法弄清楚如何接收广播.
对于我正在处理的项目,我需要自动确定视频是否是 VR (360) 视频,如果是,它是什么格式。有什么办法可以告诉吗?我在考虑元数据,但找不到任何关于此的信息。
我遇到错误:java.lang.ClassNotFoundException:org.glassfish.jersey.client.JerseyClientBuilder但是我已经导入了类,所以我不确定它为什么会弹出.我的build.gradle和代码如下:
private String getAccessToken() {
try {
Log.e("tree","get access entered");
javax.ws.rs.client.Client client = javax.ws.rs.client.ClientBuilder.newClient();
javax.ws.rs.client.Entity<String> payload =
javax.ws.rs.client.Entity.text("grant_type=client_credentials&redirect_uri=https://facebook.com/__");
javax.ws.rs.core.Response response = client.target("https://v2.api.xapo.com/oauth2/token")
.request(MediaType.TEXT_PLAIN_TYPE)
.header("Authorization","Basic ___")
.post(payload);
Log.e("tree","response completed");
String body = response.readEntity(String.class);
Log.e("tree","body "+body);
} catch(Exception e) {
Log.e("tree","token exception "+e.getMessage());
}
return "";
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试运行我的应用程序并继续遇到错误:
Error:Error converting bytecode to dex:
Cause: default or static interface method used without --min-sdk-version >= 24
Run Code Online (Sandbox Code Playgroud)
我不确定什么是错的,因为它没有提供太多信息.它以前运行过.我看过类似的问题,但他们是不同的.它们都与build.gradle中的依赖关系有关,但我已经在下面显示了.
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '8.4.3'
compile group: 'com.pubnub', name: 'pubnub-gson', version: '4.6.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.7.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', …
Run Code Online (Sandbox Code Playgroud)