Error in BroadcastReceiver
<p>I have errror in my application...
Code in activity</p>

<pre><code>SharedPreferences settings = getPreferences(Context.MODE_PRIVATE);
        String nastrPreferences = settings.getString(PREF_ACCOUNT_NAME, null);
        startService(new Intent(this, ServiceUpdate.class).putExtra("preferences", nastrPreferences));
</code></pre>

<p>In the activity I run my service. I put in intent "preferences"
In the service I get "preferences" and put in intent then transport in BroadcastReceiver</p>

<p>ServiceUpdate</p>

<pre><code>package com.example.ok1;

import...
public class ServiceUpdate extends Service {

final String Tag="States";

//*******************Google*********************
    private static final Level LOGGING_LEVEL = Level.OFF;
    com.google.api.services.tasks.Tasks client;
    private static final String PREF_ACCOUNT_NAME = "accountName";

    static final String TAG = "TasksSample";

    static final int REQUEST_GOOGLE_PLAY_SERVICES = 0;

    static final int REQUEST_AUTHORIZATION = 1;

    static final int REQUEST_ACCOUNT_PICKER = 2;

    final HttpTransport transport = AndroidHttp.newCompatibleTransport();

    final JsonFactory jsonFactory = new GsonFactory();

    GoogleAccountCredential credential;

    List&lt;String&gt; tasksList;
    List&lt;String&gt; tasksList_Note;
    List&lt;String&gt; result_Date;
    final String ATTRIBUTE_TITLE_TEXT="title";
    final String ATTRIBUTE_NOTE_TEXT="note";
    final String ATTRIBUTE_DATE_TEXT="date";
    static String preferences;
    DBHelper dbHelper;

    static com.google.api.services.tasks.Tasks service;

    int numAsyncTasks;



    //***********************************************8

    public static final int INTERVAL = 100000; // 10 sec
      public static final int FIRST_RUN = 5000; // 5 seconds
      int REQUEST_CODE = 11223344;

      AlarmManager alarmManager;

@Override
public void onCreate() {
    // TODO: действия, которые будут выполняться при создании сервиса

    Log.d(Tag, "onStartCommand");
}

public int onStartCommand(Intent intent, int flags, int startId) {
    Log.d(Tag, "onCreate");
    someTask();
    return START_REDELIVER_INTENT;
  }

public void onDestroy() {
  }

@Override
public IBinder onBind(Intent arg0) {
    // TODO Привязка сервиса

    return null;
}

void someTask() {
    //************перезапускать сервис буду тут************
    Intent intent = new Intent(this, RepeatingAlarmService.class);
    intent.putExtra("preferences", preferences);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(this, REQUEST_CODE, intent, 0);

    alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
    if (alarmManager != null) {
          alarmManager.cancel(PendingIntent.getBroadcast(this, REQUEST_CODE, intent, 0));
        }
        Toast.makeText(this, "Service Stopped!", Toast.LENGTH_LONG).show();
        Log.d(Tag, "Service onDestroy(). Stop AlarmManager at " + new java.sql.Timestamp(System.currentTimeMillis()).toString());
    alarmManager.setRepeating(
        AlarmManager.ELAPSED_REALTIME_WAKEUP,
        SystemClock.elapsedRealtime() + FIRST_RUN,
        INTERVAL,
        pendingIntent);

    Toast.makeText(this, "Service Started.", Toast.LENGTH_LONG).show();
    Log.v(this.getClass().getName(), "AlarmManger started at " + new java.sql.Timestamp(System.currentTimeMillis()).toString());

  }
</code></pre>

<p>}</p>

<p>RepeatingAlarmService</p>

<pre><code>package com.example.ok1;

import...
public class RepeatingAlarmService extends BroadcastReceiver {
final String Tag="States";
//*******************Google*********************
private static final Level LOGGING_LEVEL = Level.OFF;
com.google.api.services.tasks.Tasks client;
private static final String PREF_ACCOUNT_NAME = "accountName";

static final String TAG = "TasksSample";

static final int REQUEST_GOOGLE_PLAY_SERVICES = 0;

static final int REQUEST_AUTHORIZATION = 1;

static final int REQUEST_ACCOUNT_PICKER = 2;

final HttpTransport transport = AndroidHttp.newCompatibleTransport();

final JsonFactory jsonFactory = new GsonFactory();

GoogleAccountCredential credential;

List&lt;String&gt; tasksList;
List&lt;String&gt; tasksList_Note;
List&lt;String&gt; result_Date;
final String ATTRIBUTE_TITLE_TEXT="title";
final String ATTRIBUTE_NOTE_TEXT="note";
final String ATTRIBUTE_DATE_TEXT="date";
String preferences;
Context ctx;

static com.google.api.services.tasks.Tasks service;

int numAsyncTasks;



//***********************************************8
public void onReceive(Context context, Intent intent) {
   // Toast.makeText(context, "It's Service Time!", Toast.LENGTH_LONG).show();
    Log.d(Tag, "1Timed alarm onReceive() started at time: " + new java.sql.Timestamp(System.currentTimeMillis()).toString());
   ctx = context;

   preferences= intent.getStringExtra("preferences");//.getExtras().getString("preferences");
   googleConnect();

}

//гуглловская функция
    public void googleConnect() {
        //****************************Google********
        Log.d(Tag, "СТАРТУЕТ GOOGLEв сервисе....preferences="+preferences);
        Logger.getLogger("com.google.api.client").setLevel(LOGGING_LEVEL); 
        // Google Accounts
        credential = GoogleAccountCredential.usingOAuth2(ctx, TasksScopes.TASKS);

        credential.setSelectedAccountName(preferences);


        // Tasks client
        service =
                new com.google.api.services.tasks.Tasks.Builder(transport, jsonFactory, credential)
        .setApplicationName("Google-TasksAndroidSample/1.0").build();
        if (checkGooglePlayServicesAvailable()) {
            haveGooglePlayServices();
        }
        //************************************************  
    }
    /** Check that Google Play services APK is installed and up to date. */
    private boolean checkGooglePlayServicesAvailable() {
        Log.d(Tag, "checkGooglePlayServicesAvailable*****************************");
        final int connectionStatusCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(ctx);
        if (GooglePlayServicesUtil.isUserRecoverableError(connectionStatusCode)) {
            //  showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode);
            return false;
        }
        return true;
    }

    private void haveGooglePlayServices() {
        Log.d(Tag, "haveGooglePlayServices********************************");
        // check if there is already an account selected
        //  credential == TasksSample.c
        if (credential.getSelectedAccountName() == null) {
            Log.d(Tag, "user to choose account");
            // ask user to choose account
        //  chooseAccount();
        } else {
            Log.d(Tag, "load calendars in the receiver");
            myF();              
        }
    }

    public void myF() {
        try {
            List&lt;Task&gt; tasks = service.tasks().list("@default").execute().getItems();
            Log.d(Tag, "получили таск");
        } catch (Exception e) {
            // TODO: handle exception
            Log.d(Tag, e.getMessage());
        }

    }

}
</code></pre>

<p>But in</p>

<pre><code> preferences= intent.getStringExtra("preferences");
</code></pre>

<p>I get that preferences = null. intent dont have "preferences". Why? What I do not correctly? 
Log</p>

<pre><code>05-31 19:58:32.337: E/GoogleAuthUtil(19130): Calling this from your main thread can lead to deadlock and/or ANRs
05-31 19:58:32.337: E/GoogleAuthUtil(19130): java.lang.IllegalStateException: calling this from your main thread can lead to deadlock
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.android.gms.auth.GoogleAuthUtil.b(Unknown Source)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:192)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:217)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:836)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:412)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:345)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:463)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.example.ok1.RepeatingAlarmService.myF(RepeatingAlarmService.java:126)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.example.ok1.RepeatingAlarmService.haveGooglePlayServices(RepeatingAlarmService.java:110)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.example.ok1.RepeatingAlarmService.googleConnect(RepeatingAlarmService.java:85)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.example.ok1.RepeatingAlarmService.onReceive(RepeatingAlarmService.java:65)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:1798)
v05-31 19:58:32.337: E/GoogleAuthUtil(19130):   at android.app.ActivityThread.access$2400(ActivityThread.java:117)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at android.os.Looper.loop(Looper.java:130)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at android.app.ActivityThread.main(ActivityThread.java:3687)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at java.lang.reflect.Method.invokeNative(Native Method)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at java.lang.reflect.Method.invoke(Method.java:507)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
05-31 19:58:32.337: E/GoogleAuthUtil(19130):    at dalvik.system.NativeStart.main(Native Method)
</code></pre>
