Skip to content

Commit 2ed375e

Browse files
committed
Revert "Better message parsing and notification building"
This reverts commit 3a0b035.
1 parent 09bf411 commit 2ed375e

3 files changed

Lines changed: 33 additions & 124 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@
2121
<uses-permission android:name="android.permission.INTERNET" />
2222

2323
<!-- Permissions required by the sync adapter -->
24-
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
25-
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
26-
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
24+
<uses-permission
25+
android:name="android.permission.READ_SYNC_SETTINGS"/>
26+
<uses-permission
27+
android:name="android.permission.WRITE_SYNC_SETTINGS"/>
28+
<uses-permission
29+
android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
2730

2831
<!-- Permissions required to make our UI more friendly -->
29-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
32+
<uses-permission
33+
android:name="android.permission.ACCESS_NETWORK_STATE" />
3034

3135
<!-- Permissions required for Google Cloud Messaging -->
3236
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
33-
<permission
34-
android:name="com.example.android.sunshine.app.permission.C2D_MESSAGE"
37+
<permission android:name="com.example.android.sunshine.app.permission.C2D_MESSAGE"
3538
android:protectionLevel="signature" />
3639
<uses-permission android:name="com.example.android.sunshine.app.permission.C2D_MESSAGE" />
3740

@@ -43,8 +46,8 @@
4346
android:supportsRtl="true">
4447
<activity
4548
android:name=".MainActivity"
46-
android:label="@string/app_name"
47-
android:theme="@style/ForecastTheme" >
49+
android:theme="@style/ForecastTheme"
50+
android:label="@string/app_name" >
4851
<intent-filter>
4952
<action android:name="android.intent.action.MAIN" />
5053

@@ -63,24 +66,22 @@
6366
android:name=".SettingsActivity"
6467
android:label="@string/title_activity_settings"
6568
android:parentActivityName=".MainActivity"
66-
android:theme="@style/SettingsTheme" >
69+
android:theme="@style/SettingsTheme">
6770
<meta-data
6871
android:name="android.support.PARENT_ACTIVITY"
6972
android:value="com.example.android.sunshine.app.MainActivity" />
7073
</activity>
71-
7274
<provider
73-
android:name=".data.WeatherProvider"
7475
android:authorities="@string/content_authority"
76+
android:name=".data.WeatherProvider"
7577
android:exported="false"
7678
android:syncable="true" />
7779

7880
<!-- SyncAdapter's dummy authentication service -->
79-
<service android:name=".sync.SunshineAuthenticatorService" >
81+
<service android:name=".sync.SunshineAuthenticatorService">
8082
<intent-filter>
8183
<action android:name="android.accounts.AccountAuthenticator" />
8284
</intent-filter>
83-
8485
<meta-data
8586
android:name="android.accounts.AccountAuthenticator"
8687
android:resource="@xml/authenticator" />
@@ -89,25 +90,25 @@
8990
<!-- The SyncAdapter service -->
9091
<service
9192
android:name=".sync.SunshineSyncService"
92-
android:exported="true" >
93+
android:exported="true"
94+
>
9395
<intent-filter>
9496
<action android:name="android.content.SyncAdapter" />
9597
</intent-filter>
96-
9798
<meta-data
9899
android:name="android.content.SyncAdapter"
99100
android:resource="@xml/syncadapter" />
100101
</service>
101102

102-
<!-- GCM receiver -->
103-
<receiver
104-
android:name=".GcmBroadcastReceiver"
105-
android:permission="com.google.android.c2dm.permission.SEND" >
106-
<intent-filter>
107-
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
108-
<category android:name="com.example.android.sunshine.app" />
109-
</intent-filter>
110-
</receiver>
103+
<!-- GCM receiver - Commented out until we write the class -->
104+
<!--<receiver-->
105+
<!--android:name=".GcmBroadcastReceiver"-->
106+
<!--android:permission="com.google.android.c2dm.permission.SEND" >-->
107+
<!--<intent-filter>-->
108+
<!--<action android:name="com.google.android.c2dm.intent.RECEIVE" />-->
109+
<!--<category android:name="com.example.android.sunshine.app" />-->
110+
<!--</intent-filter>-->
111+
<!--</receiver>-->
111112
</application>
112113

113114
</manifest>

app/src/main/java/com/example/android/sunshine/app/GcmBroadcastReceiver.java

Lines changed: 0 additions & 93 deletions
This file was deleted.

app/src/main/java/com/example/android/sunshine/app/MainActivity.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.google.android.gms.gcm.GoogleCloudMessaging;
3636

3737
import java.io.IOException;
38+
import java.util.concurrent.atomic.AtomicInteger;
3839

3940
public class MainActivity extends ActionBarActivity implements ForecastFragment.Callback {
4041

@@ -45,10 +46,10 @@ public class MainActivity extends ActionBarActivity implements ForecastFragment.
4546
private static final String PROPERTY_APP_VERSION = "appVersion";
4647

4748
/**
48-
* Substitute you own project number here. This project number comes
49-
* from the Google Developers Console.
49+
* Substitute you own sender ID here. This is the project number you got
50+
* from the API Console.
5051
*/
51-
static final String PROJECT_NUMBER = "Your Project Number";
52+
String SENDER_ID = "Your-Sender-ID";
5253

5354
private boolean mTwoPane;
5455
private String mLocation;
@@ -90,10 +91,10 @@ protected void onCreate(Bundle savedInstanceState) {
9091
mGcm = GoogleCloudMessaging.getInstance(this);
9192
String regId = getRegistrationId(this);
9293

93-
if (PROJECT_NUMBER.equals("Your Project Number")) {
94+
if (SENDER_ID.equals("Your-Sender-ID")) {
9495
new AlertDialog.Builder(this)
95-
.setTitle("Needs Project Number")
96-
.setMessage("GCM will not function in Sunshine until you set the Project Number to the one from the Google Developers Console.")
96+
.setTitle("Needs Sender ID")
97+
.setMessage("GCM will not function in Sunshine until you replace your Sender ID with a Sender ID from the Google Developers Console.")
9798
.setPositiveButton(android.R.string.ok, null)
9899
.create().show();
99100
} else if (regId.isEmpty()) {
@@ -262,7 +263,7 @@ protected Void doInBackground(Void... params) {
262263
if (mGcm == null) {
263264
mGcm = GoogleCloudMessaging.getInstance(context);
264265
}
265-
String regId = mGcm.register(PROJECT_NUMBER);
266+
String regId = mGcm.register(SENDER_ID);
266267
msg = "Device registered, registration ID=" + regId;
267268

268269
// You should send the registration ID to your server over HTTP,

0 commit comments

Comments
 (0)