2014-04-23 34 views
0

我正試圖在Android上實現Scringo登錄狀態更改。但我的廣播接收器從來沒有被調用。 我已經按照上http://www.scringo.com/docs/android-guides/popular/handling-login-status-changes/Scringo在Android上未收到Scringo登錄狀態更改

描述的指令,因此我註冊了我的廣播接收器:

<receiver android:name="com.jino.footster.MyReceiver"> 
     <intent-filter> 
      <action android:name="com.scringo.LoginBroadcast" /> 
     </intent-filter> 
    </receiver> 

然後我定義我的Broacast接收器:

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):Your Sc ringo用戶令牌是:a03fgalc5E

但是,我的廣播接收機的onReceive方法從來沒有被調用過。

有人能幫忙嗎?

謝謝

回答

0

你忘了類別:

<receiver android:name="com.jino.footster.MyReceiver"> 
     <intent-filter> 
      <action android:name="com.scringo.LoginBroadcast" /> 
      <category android:name="com.jino.footster"/> 
     </intent-filter> 
    </receiver> 
+0

謝謝。你解決了它。 – user3447721