相关疑难解决方法(0)

用android发出HTTP请求

我到处搜索但我找不到答案,有没有办法发出简单的HTTP请求?我想在我的某个网站上请求PHP页面/脚本,但我不想显示该网页.

如果可能的话我甚至想在后台(在BroadcastReceiver中)这样做

android httpwebrequest androidhttpclient

347
推荐指数
9
解决办法
41万
查看次数

Android - 没有获得GCM令牌

我打电话给RegistrationIntentService:

    if (checkPlayServices()) {
        Log.i("udazzT", "check servicies");
        // Start IntentService to register this application with GCM.
        Intent intent2 = new Intent(this, RegistrationIntentService.class);
        startService(intent2);
    }
Run Code Online (Sandbox Code Playgroud)

但我在RegistrationIntentService中看不到任何日志:

public class RegistrationIntentService extends IntentService {

    private static final String TAG = "RegIntentService";
    private static final String[] TOPICS = {"global"};

    public RegistrationIntentService() {
        super(TAG);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        Log.i("udazzT", "setting token");
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

        try {
            // In the (unlikely) event that multiple refresh operations occur simultaneously,
            // ensure …
Run Code Online (Sandbox Code Playgroud)

android google-cloud-messaging

8
推荐指数
1
解决办法
7616
查看次数

注册ID从android 2.3.3,2.3.5中的gcm为null但它不是null并且在android 2.3.4,4.0.4中工作

private void registerClient() {
    try {
        GCMRegistrar.checkDevice(this);
        GCMRegistrar.checkManifest(this);
        regId = GCMRegistrar.getRegistrationId(this);
        if (regId.equals("")) {
            registrationStatus = "Registering...";
            GCMRegistrar.register(this, "1074338555805");
            regId = GCMRegistrar.getRegistrationId(this);
            registrationStatus = "Registration Acquired";
            sendRegistrationToServer();
        } else {
            registrationStatus = "Already registered";
        }
    } catch (Exception e) {
        e.printStackTrace();
        registrationStatus = e.getMessage();
    }
}
Run Code Online (Sandbox Code Playgroud)

注册ID从android 2.3.3,2.3.5中的gcm为null但它不是null并且在android 2.3.4,4.0.4中工作.

android google-cloud-messaging

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