// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
// 
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
// 
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";


import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG;
package com.apigee.push;




public class PushMainActivity extends Activity {

  private TextView messageTextView;
  private Button sendButton;
  private AlertDialogManager alert = new AlertDialogManager();

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // this is a hack to force AsyncTask to be initialized on main thread. Without this things
    // won't work correctly on older versions of Android (2.2, apilevel=8)
    try {
    	Class.forName("android.os.AsyncTask");
    } catch (Exception ignored) {}
    
    GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this);

    initUI();

    AppServices.loginAndRegisterForPush(this);
  }

  private void initUI() {
    setContentView(R.layout.main);
    messageTextView = (TextView)findViewById(R.id.lblMessage);

    sendButton = (Button)findViewById(R.id.sendButton);
    sendButton.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        AppServices.sendMyselfANotification(v.getContext());
      }
    });

// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
// 
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
// 
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";


// Path: samples/push/app/src/main/java/com/apigee/push/PushMainActivity.java
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG;

package com.apigee.push;




public class PushMainActivity extends Activity {

  private TextView messageTextView;
  private Button sendButton;
  private AlertDialogManager alert = new AlertDialogManager();

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // this is a hack to force AsyncTask to be initialized on main thread. Without this things
    // won't work correctly on older versions of Android (2.2, apilevel=8)
    try {
    	Class.forName("android.os.AsyncTask");
    } catch (Exception ignored) {}
    
    GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this);

    initUI();

    AppServices.loginAndRegisterForPush(this);
  }

  private void initUI() {
    setContentView(R.layout.main);
    messageTextView = (TextView)findViewById(R.id.lblMessage);

    sendButton = (Button)findViewById(R.id.sendButton);
    sendButton.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        AppServices.sendMyselfANotification(v.getContext());
      }
    });

    registerReceiver(notificationReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION));