Switched to using the Google Developer lingo for project number.

This commit is contained in:
Dan Galpin
2015-05-24 23:57:47 -07:00
parent 83cfcaff0f
commit c18dcee638

View File

@@ -46,10 +46,10 @@ public class MainActivity extends ActionBarActivity implements ForecastFragment.
private static final String PROPERTY_APP_VERSION = "appVersion"; private static final String PROPERTY_APP_VERSION = "appVersion";
/** /**
* Substitute you own sender ID here. This is the project number you got * Substitute you own project number here. This project number comes
* from the API Console. * from the Google Developers Console.
*/ */
String SENDER_ID = "Your-Sender-ID"; static final String PROJECT_NUMBER = "Your Project Number";
private boolean mTwoPane; private boolean mTwoPane;
private String mLocation; private String mLocation;
@@ -91,10 +91,10 @@ public class MainActivity extends ActionBarActivity implements ForecastFragment.
mGcm = GoogleCloudMessaging.getInstance(this); mGcm = GoogleCloudMessaging.getInstance(this);
String regId = getRegistrationId(this); String regId = getRegistrationId(this);
if (SENDER_ID.equals("Your-Sender-ID")) { if (PROJECT_NUMBER.equals("Your Project Number")) {
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setTitle("Needs Sender ID") .setTitle("Needs Project Number")
.setMessage("GCM will not function in Sunshine until you replace your Sender ID with a Sender ID from the Google Developers Console.") .setMessage("GCM will not function in Sunshine until you set the Project Number to the one from the Google Developers Console.")
.setPositiveButton(android.R.string.ok, null) .setPositiveButton(android.R.string.ok, null)
.create().show(); .create().show();
} else if (regId.isEmpty()) { } else if (regId.isEmpty()) {
@@ -263,7 +263,7 @@ public class MainActivity extends ActionBarActivity implements ForecastFragment.
if (mGcm == null) { if (mGcm == null) {
mGcm = GoogleCloudMessaging.getInstance(context); mGcm = GoogleCloudMessaging.getInstance(context);
} }
String regId = mGcm.register(SENDER_ID); String regId = mGcm.register(PROJECT_NUMBER);
msg = "Device registered, registration ID=" + regId; msg = "Device registered, registration ID=" + regId;
// You should send the registration ID to your server over HTTP, // You should send the registration ID to your server over HTTP,
@@ -279,7 +279,7 @@ public class MainActivity extends ActionBarActivity implements ForecastFragment.
storeRegistrationId(context, regId); storeRegistrationId(context, regId);
} catch (IOException ex) { } catch (IOException ex) {
msg = "Error :" + ex.getMessage(); msg = "Error :" + ex.getMessage();
// TODO(joannasmith): If there is an error, don't just keep trying to register. // TODO: If there is an error, don't just keep trying to register.
// Require the user to click a button again, or perform // Require the user to click a button again, or perform
// exponential back-off. // exponential back-off.
} }