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";
/**
* Substitute you own sender ID here. This is the project number you got
* from the API Console.
* Substitute you own project number here. This project number comes
* from the Google Developers Console.
*/
String SENDER_ID = "Your-Sender-ID";
static final String PROJECT_NUMBER = "Your Project Number";
private boolean mTwoPane;
private String mLocation;
@@ -91,10 +91,10 @@ public class MainActivity extends ActionBarActivity implements ForecastFragment.
mGcm = GoogleCloudMessaging.getInstance(this);
String regId = getRegistrationId(this);
if (SENDER_ID.equals("Your-Sender-ID")) {
if (PROJECT_NUMBER.equals("Your Project Number")) {
new AlertDialog.Builder(this)
.setTitle("Needs Sender ID")
.setMessage("GCM will not function in Sunshine until you replace your Sender ID with a Sender ID from the Google Developers Console.")
.setTitle("Needs Project Number")
.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)
.create().show();
} else if (regId.isEmpty()) {
@@ -263,7 +263,7 @@ public class MainActivity extends ActionBarActivity implements ForecastFragment.
if (mGcm == null) {
mGcm = GoogleCloudMessaging.getInstance(context);
}
String regId = mGcm.register(SENDER_ID);
String regId = mGcm.register(PROJECT_NUMBER);
msg = "Device registered, registration ID=" + regId;
// 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);
} catch (IOException ex) {
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
// exponential back-off.
}