小编Amr*_*ngh的帖子

Instagram oauth api给出{"code":400,"error_type":"OAuthException","error_message":"找不到匹配的代码." }

我正在开发一个与Instagram API集成的应用程序来访问用户信息.我使用authorize url成功获取了访问令牌,但无法使用access_token url获取userId:

我尝试了两个端点:

https://api.instagram.com/oauth/access_token?client_id=48275564e2c445f6b8e1356djfha3e0c&client_secret=ab2062da9f314e3489dke7ae9cbe6e5d&redirect_uri=http://localhost&grant_type=authorization_code
Run Code Online (Sandbox Code Playgroud)

https://api.instagram.com/oauth/access_token

与邮政机构一样:

client_id=48275564e2c445f6b8e1356djfha3e0c&client_secret=ab2062da9f314e3489dke7ae9cbe6e5d&redirect_uri=http://localhost&grant_type=authorization_code&code=1351860224.4827556.5dc92c4d15ea4a4ea1b0d33eaf0eef19
Run Code Online (Sandbox Code Playgroud)

(请求中的数据被修改),但我得到了以下内容

{
    "code": 400,
    "error_type": "OAuthException",
    "error_message": "No matching code found."
}
Run Code Online (Sandbox Code Playgroud)

我已经看到了大量的查询和问题,但找不到任何问题的解决方案.

我有几个问题是:

1) is the field code in the URL is same as access_token, if not how could i get the code field's value.

2) is there any other mechanism(API) to fetch the user details given the username is not known.
Run Code Online (Sandbox Code Playgroud)

请帮助我,因为我完全陷入困境并且完成了我的截止日期.

oauth-2.0 instagram

25
推荐指数
1
解决办法
3万
查看次数

如何从GMT TimeZone到IST TimeZone和Vice Versa在android中解析日期

我正在开发一个项目,从后端IST(印度标准时间)获取日期/时间,如图所示"2013-01-09T19:32:49.103+05:30".但是当我使用以下DateFormat解析它时

DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
Run Code Online (Sandbox Code Playgroud)

然后解析..

Date date = sdf.parse("2013-01-09T19:32:49.103+05:30");


System.out.println("XYZ ==============>"+date);
Run Code Online (Sandbox Code Playgroud)

以GMT格式显示日期作为输出即

Wed Jan 09 14:02:49 GMT+00:00 2013.
Run Code Online (Sandbox Code Playgroud)

我已经尝试使用TimeZone类作为..

TimeZone timeZone=TimeZone.getTimeZone("IST");
sdf.setTimeZone(timeZone);
Run Code Online (Sandbox Code Playgroud)

但没有效果..

我怎么能得到一个Date具有日期IST格式而不是GMT 的类对象...

请提供适当的解决方案..

编辑:

这是代码的样子:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");

TimeZone timeZone=TimeZone.getTimeZone("IST");
sdf.setTimeZone(timeZone);

Date date = sdf.parse("2013-01-09T19:32:49.103+05:30");
String formattedDate=sdf.format(date);

System.out.println("XYZ ==============>"+formattedDate);
Run Code Online (Sandbox Code Playgroud)

java timezone android date simpledateformat

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

如何计算Arc中终点的坐标如果中心和起始坐标在Android中已知为扫描角度?

我正在绘制一个饼图,其中我绘制了具有已知扫描角度的弧.现在我想在每个弧的中心显示标签,或者说从每个弧的中心绘制一条线.

鉴于我知道中心坐标,起始坐标,扫掠角和半径,我想计算结束坐标.

我也尝试过绘制一个匹配所有坐标的三角形并使用距离公式,但我不知道如何在java中求解方程式.

请给我一个合适的解决方案.

java math geometry android pie-chart

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

未捕获的ReferenceError,通过android应用程序调用javascript函数..?

我试图通过android Webview Activity调用javascript函数setGameName(),但它正在抛出uncaught ReferenceError:setGameName not defined at :1.

我的源代码如下:

webView2.setWebChromeClient(new WebChromeClient());
webView2.getSettings().setLightTouchEnabled(true);
webView2.getSettings().setJavaScriptEnabled(true);
webView2.addJavascriptInterface(jsInterface, "AndroidFunction");
webView2.loadUrl("file:///android_asset/www/index.html");
webView2.loadUrl("javascript:setGameName()");
Run Code Online (Sandbox Code Playgroud)

Html代码:

    <body>

        <script type="text/javascript">
            function init() {
                console.log("====== I am getting called::===");
                var testVal = document.getElementById('playertextId').value;
                AndroidFunction.proceedFurther(testVal);
            };

            function setGameName() {
                console.log("====== Got the value===");
                document.getElementById('gametextId').value;
            };
        </script>
</body>
Run Code Online (Sandbox Code Playgroud)

它正在加载index.html很好但在函数调用时抛出异常,请提供适当的解决方案..

更新:

i have found the problem the page is not getting loaded at the time of function call..(Since on giving a time delay of 5000ms it is getting called..)!!
Run Code Online (Sandbox Code Playgroud)

但是我如何实施呢?

javascript android webview referenceerror

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

Android12 - StartActivity 在画中画模式扩展后不起作用

我正在开发一个使用 Android 画中画模式的应用程序。

MainActivity 有一个按钮,可以启动其他一些活动(只是向另一个活动触发意图)。当我进入 PIP 模式并展开 MainActivity 时会出现问题,现在当我单击按钮时,新 Activity 大约需要 7-8 秒才能可见。此外,如果重复该模式,则活动的意图将被完全忽略,并且 SampleActivity 永远不会启动。

Android-12 以下一切正常。发生在 Pixel 设备上(因为 12 目前仅在 Pixel 上可用。)

以下是示例代码片段(具有相同问题的示例项目代码)。

清单文件:

<activity
            android:name=".MainActivity"
            android:exported="true"
            android:taskAffinity=".MainActivity"
            android:configChanges=
                "screenSize|smallestScreenSize|screenLayout|orientation"
            android:resizeableActivity="true"
            android:screenOrientation="portrait"
            android:supportsPictureInPicture="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".SampleActivity" />
Run Code Online (Sandbox Code Playgroud)

画中画模式:

enterPictureInPictureMode(
            PictureInPictureParams.Builder().setActions()
                .setAspectRatio(
                    Rational(
                        140,
                        190
                    )
                )
                .build()
        )
Run Code Online (Sandbox Code Playgroud)

按钮点击意图

findViewById<Button>(R.id.btnClickMe).setOnClickListener {
            (it as? Button)?.text = "Clicked"
            val intent = Intent(this@MainActivity, SampleActivity::class.java)
            startActivity(intent)
        }
Run Code Online (Sandbox Code Playgroud)

尝试使用清单标志/配置,但没有运气。请提供必要的建议。

android start-activity android-picture-in-picture android-12

5
推荐指数
0
解决办法
932
查看次数