Created
June 16, 2016 09:57
-
-
Save DASAR-zz/d3d54bf671a09363f53239150ed43501 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
RichNotifications.onNewIntent(this, getIntent()); | |
} | |
@Override | |
protected void onResume() { | |
super.onResume(); | |
// Check for Google Services + register for Remote Notifications | |
RichNotifications.checkForGoogleServicesAndRegister(this, "jhondoe"); | |
} | |
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
RichNotifications.onActivityResult(this, requestCode, resultCode); | |
} | |
@Override | |
protected void onNewIntent(Intent intent) { | |
super.onNewIntent(intent); | |
RichNotifications.onNewIntent(this, intent); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.test.app"> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<!-- Required to handle connectivity change event --> | |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
<permission | |
android:name="com.test.app.permission.C2D_MESSAGE" | |
android:protectionLevel="signature" /> | |
<uses-permission android:name="com.test.app.permission.C2D_MESSAGE" /> | |
<application | |
android:name=".MyApp" | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:supportsRtl="true" | |
android:theme="@style/AppTheme"> | |
<activity android:name="com.test.app.MainActivity"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> | |
</activity> | |
<receiver | |
android:name="com.google.android.gms.gcm.GcmReceiver" | |
android:exported="true" | |
android:permission="com.google.android.c2dm.permission.SEND"> | |
<intent-filter> | |
<action android:name="com.google.android.c2dm.intent.RECEIVE" /> | |
<action android:name="com.google.android.c2dm.intent.REGISTRATION" /> | |
<category android:name="com.test.app" /> | |
</intent-filter> | |
</receiver> | |
<service | |
android:name="app.test.richnotifications.InstanceIDService" | |
android:exported="false"> | |
<intent-filter> | |
<action android:name="com.google.android.gms.iid.InstanceID" /> | |
</intent-filter> | |
</service> | |
<service | |
android:name="app.test.richnotifications.RegistrationIntentService" | |
android:exported="false" /> | |
<receiver android:name="app.test.richnotifications.ConnectivityChangeListener"> | |
<intent-filter> | |
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> | |
</intent-filter> | |
</receiver> | |
<service | |
android:name="app.test.richnotifications.GCMListener" | |
android:exported="false"> | |
<intent-filter> | |
<action android:name="com.google.android.c2dm.intent.RECEIVE" /> | |
</intent-filter> | |
</service> | |
</application> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyApp extends Application { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
// Provide Activity class which should be launched, API key & secret, GCM sender ID, notification icon | |
RichNotifications.configure(getCacheDir(), MainActivity.class, | |
getString(R.string.API_KEY), getString(R.string.API_SECRET), | |
getString(R.string.gcm_defaultSenderId), R.drawable.ic_notification_small); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<string name="API_KEY">a94a8fe5ccb19ba61c4c0873d391e987982fbbd3</string> | |
<string name="API_SECRET">99efc50a9206bde3d7a8e694aad8e138ca7dc3f7</string> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment