小编use*_*127的帖子

IAB startSetup NullPointerException

我正在尝试在我的应用程序中设置应用程序内结算.我没有走得太远,并且在尝试启动IabHelper时遇到了空指针异常.我正在关注这个谷歌教程.

import com.iabtest.util.IabHelper;
import com.iabtest.util.IabResult;

public class MainActivity extends Activity
{
    IabHelper mHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String base64EncodedPublicKey = "My_secret_key";

        mHelper = new IabHelper(this, base64EncodedPublicKey);
        mHelper.enableDebugLogging(true); //Turned on to try to help solve the issue
        Log.d("TEST", "Starting setup.");
        mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener()
        {
            public void onIabSetupFinished(IabResult result)
            {
                Log.d("TEST", "Setup finished.");

                if(!result.isSuccess())
                {
                    // Oh noes, there was a problem.
                    Log.d("TEST", "Problem setting up in-app billing: " + result);
                    return;
                }

                //IAB SET UP!
                Log.d("TEST", …
Run Code Online (Sandbox Code Playgroud)

android in-app-purchase in-app-billing

21
推荐指数
2
解决办法
4641
查看次数

Google Flight RPC和构建JSON数组

我正在尝试使用Google Flight RPC,但是无法构建一个json数组来发布它.我发现的唯一文件就在这里.它描述了需要发送的内容,但没有解释如何构造json数组.具体来说,使用PHP,我不知道如何使用链接文档的第1部分中的以下示例构建和发布json数组.

[,[[,"fs","[,[,[\"SJC\"]\n,\"2012-04-05\",[\"EWR\",\"JFK\",\"LGA\"]\n,\"2012-04-12\"]\n]\n"]
]
,[,[[,"b_ca","54"]
,[,"f_ut","search;f=SJC;t=EWR,JFK,LGA;d=2012-04-05;r=2012-04-12"]
,[,"b_lr","11:36"]
,[,"b_lr","1:1528"]
,[,"b_lr","2:1827"]
,[,"b_qu","3"]
,[,"b_qc","1"]
]
]
] 
Run Code Online (Sandbox Code Playgroud)

上面似乎没有正确格式化以放入json数组.此外,还需要HTTP请求标头.我假设这些是通过cURL设置的?我不清楚有关如何执行此操作的文档.

我已经尝试了几次尝试,但我没有收到文档中显示的任何响应.

编辑:太棒了,我为这个问题买了一个Tumbleweed徽章!我很感激帮助.谢谢.

php rpc json curl http-post

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

标签 统计

android ×1

curl ×1

http-post ×1

in-app-billing ×1

in-app-purchase ×1

json ×1

php ×1

rpc ×1