小编San*_*ani的帖子

在牛轧糖中自动接听来电

有没有办法在没有root权限的情况下以编程方式应答Android 7.0中的来电?我尝试了以下方式接听来电。

 TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
                  Class<?> c = Class.forName(tm.getClass().getName());
                  Method m = c.getDeclaredMethod("getITelephony");
                  m.setAccessible(true);
                  Object telephonyService = m.invoke(tm);
                  Class<?> telephonyServiceClass = Class.forName(telephonyService.getClass().getName());
                  Method endCallMethod = telephonyServiceClass.getDeclaredMethod("answerRingingCall");
                  endCallMethod.invoke(telephonyService);
Run Code Online (Sandbox Code Playgroud)

android call telephonymanager android-phone-call

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

如何在给定的预定时间内自动在Facebook页面上发布更新?使用android

当用户设置特定的预定时间时,我需要在页面上自动发布.我尝试使用Graph api和以下请求:

    Bundle params1 = new Bundle();
    params1.putString("message", "This is a system generated post");
    params1.putString("scheduled_publish_time",(date.getTime()+(1000*60*30))""); //for current time to next 30 min
    params1.putBoolean("published", false);
    new GraphRequest(
            accessToken,
            "/850285671748182/feed",               
            params1,
            HttpMethod.POST,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
        /* handle the result */
                    Log.d("Response-auto", "DATA" + response);

                }
            }
    ).executeAsync();
Run Code Online (Sandbox Code Playgroud)

但它给出了以下回应.

{"error": {"message": "(#100) The specified scheduled publish time is invalid.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "HcuHy8cusGC"}}
Run Code Online (Sandbox Code Playgroud)

android facebook facebook-graph-api android-facebook facebook-share

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

在Android MediaStore.EXTRA_DURATION_LIMIT中不能在6.0及更高版本的设备中使用

我正在使用LG Nexus(6.0)。当我使用相机使用以下代码捕获视频时。

   Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
   fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);
    // set video quality
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); 
Run Code Online (Sandbox Code Playgroud)

我使用下面的代码给出了它的持续时间限制。

    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30);
Run Code Online (Sandbox Code Playgroud)

相机似乎忽略了持续时间限制。在任何6.0设备上,它均不起作用。还有另一种方法来限制6.0 +设备上的捕获视频持续时间吗?

video android video-capture android-video-player

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

如何在Android设备中获取当前支持的语言?

我们如何检查Android设备上的选定语言支持?或如何在Android设备中获取当前支持的语言

android locale localization

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

无法从Android中的MI-Oreo(MI-A2)设备的下载文件夹中获取用于选择任何文件的URI

我需要帮助来获取我们通过 Intent 从下载文件夹或任何其他文件夹中选择的内容的文件路径。我附上了一个我一直在使用的fileUtil类,它在牛轧糖版本之前运行良好。但是对于奥利奥以及在某些特定设备中也是如此,我们会收到一个空路径作为回报。因此,如果有人遇到过此类错误并找到了解决方案,请在此处分享。

if(resultCode ==RESULT_OK)
{
    final Uri uri = data.getData();
    // Get the File path from the Uri
    String path = FileUtils.getPath(this, uri);
    // Alternatively, use FileUtils.getFile(Context, Uri)
    if (path != null && FileUtils.isLocal(path)) {
        //File file = new File(path);
        this.file = new File(path);
        profile_imagepath = path;
        filename = file.getName();
        txtselectedfile.setText(filename);
    }
}
Run Code Online (Sandbox Code Playgroud)

uri file android-file android-fileprovider

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