/**
 Android
 developer center  */

Go back to Xamarin Getting Started Guide

Pyze Xamarin App SDK - Push Notifications (Android)

Turn on Push Notifications in your App project

  1. Create a new Android project at https://console.firebase.google.com/ and download the google-services.json.
        Create Firebase Project
        Download json file
  2. Add the below string resouces, with values extracted from google-services.json to the Resources -> values file, if values file is not present then please create one.
    //values of string resources here represent, key path to get the values from google-services.json
    			
    <string name="default_web_client_id" translatable="false"> client ->oauth_client ->client_id </string>
    <string name="firebase_database_url" translatable="false"> project_info ->firebase_url </string>
    <string name="gcm_defaultSenderId" translatable="false"> project_info ->project_number </string>
    <string name="google_api_key" translatable="false"> client ->api_key ->current_key </string>
    <string name="google_app_id" translatable="false"> client ->client_info ->mobilesdk_app_id </string>
    <string name="google_crash_reporting_api_key" translatable="false"> client ->api_key ->current_key </string>
    <string name="google_storage_bucket" translatable="false"> project_info ->storage_bucket </string> 
  3. Make sure that you are using the same package name in firebase and your Xamarin project.
  4. Add the following entries to you AndroidManifest.xml file. Be sure to replace the two instances of "My_Package_Name" below with your App's package name:
    
        <activity android:name="com.pyze.android.push.PyzePushTrackingActivity" android:exported="true"/>
        <service android:name="com.pyze.android.push.fcm.FcmPushListenerService">
        <intent-filter>
          <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
        </service>
        <service android:name="com.pyze.android.push.fcm.FcmInstanceIDListenerService" android:exported="false">
        <intent-filter>
          <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
        </service>
        <provider android:name="com.google.firebase.provider.FirebaseInitProvider"
         android:authorities="My_Package_Name.firebaseinitprovider"
         android:exported="false"
         android:initOrder="100" />
        <service android:name="com.google.firebase.iid.FirebaseInstanceIdService" android:exported="true" >
        <intent-filter android:priority="-500" > 
          <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
        </service>
        <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
         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="My_Package_Name" />
        </intent-filter>
        </receiver>
        <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
        <service android:name="com.google.firebase.messaging.FirebaseMessagingService" android:exported="true" >
        <intent-filter android:priority="-500" >
          <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
        </service>

Go back to Xamarin Developer Center.


About Pyze

Pyze Growth Intelligence® is a transformative SaaS platform that enables mobile and web app businesses to automate engagement, retention and growth of their users. Signup at Pyze, install and initialize the Pyze SDK and watch your app grow.