我正在尝试在 Android 上实现 Scringo 登录状态更改。但是我的广播接收器永远不会被调用。我已按照http://www.scringo.com/docs/android-guides/popular/handling-login-status-changes/上描述的说明进行操作
所以我注册了我的广播接收器:
<receiver android:name="com.jino.footster.MyReceiver">
<intent-filter>
<action android:name="com.scringo.LoginBroadcast" />
</intent-filter>
</receiver>
然后我定义了我的广播接收器:
package com.jino.footster;
import com.scringo.utils.ScringoLogger;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("com.scringo.LoginBroadcast")) {
boolean isLogin = intent.getExtras().getBoolean("isLogin");
String accountId = intent.getExtras().getString("accountId");
ScringoLogger.e("Got Login receiver: " + isLogin + ", " + accountId);
}
}
}
当我启动应用程序时,登录似乎成功:我在 logcat 中看到以下消息:
04-24 01:12:35.000:I/Scringo(4717):您的 Scringo 用户令牌是:a03fgalc5E
但是,我的广播接收器的 onReceive 方法永远不会被调用。
有人能帮忙吗?
谢谢你