小编Dre*_*Org的帖子

Android前台服务通知未显示

我正在尝试启动前台服务.我收到通知,该服务确实启动但通知始终被抑制.我仔细检查了应用是否允许在我的设备上的应用信息中显示通知.这是我的代码:

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.

notifications android

18
推荐指数
5
解决办法
2万
查看次数

如何监视文件夹中的文件更改在后台?

我正在尝试在后台监视用户磁盘上的文件夹,就像你可以使用JobScheduler和监视库更改一样contentobserver.我想为任何指定的目录执行此操作.但是,当目录有任何文件更改时,我无法弄清楚如何接收广播.

android

11
推荐指数
2
解决办法
5092
查看次数

有什么方法可以判断视频是 360 度还是全景图?

对于我正在处理的项目,我需要自动确定视频是否是 VR (360) 视频,如果是,它是什么格式。有什么办法可以告诉吗?我在考虑元数据,但找不到任何关于此的信息。

virtual-reality 360-panorama 360-virtual-reality

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

java.lang.ClassNotFoundException:org.glassfish.jersey.client.JerseyClientBuilder错误?

我遇到错误: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)

java

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

Android - 使用min sdk版本将Bytecode转换为Dex时出错

我正在尝试运行我的应用程序并继续遇到错误:

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)

java android dex kotlin

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