'Resource.String' Does not contain a definition for 'gcm_defaultSenderId' xamarin

0

I'm implementing Push Notification in my app, it was working, but now the error is in two variables not defined in the Resource in google_app_id and gcm_defaultSenderId. When I try to add them manually in the resource of sure of first more in the second to see that I will execute already it accuses to me the error again (resource file and replaced)

What might be happening so they do not stay fixed in my application?

if(!GetString(Resource.String.google_app_id).Equals("000000000000000000000000000"))
                throw new System.Exception("Invalid Json file");

        Task.Run(() => {
            var instanceId = FirebaseInstanceId.Instance;
            instanceId.DeleteInstanceId();
            Android.Util.Log.Debug("TAG", "{0} {1}", instanceId.Token, instanceId.GetToken(GetString(Resource.String.gcm_defaultSenderId), Firebase.Messaging.FirebaseMessaging.InstanceIdScope));
        });
    
asked by anonymous 12.07.2017 / 17:19

1 answer

0

This error occurs when you try to use a string that was not created in the Strings.xml file.

Within the root of your project, go into the Resources / values folder and open the Strings.xml file. If you do not have this file, create a new one exactly under that name "Strings" of type XML.

The structure of it is as follows (already with the strings you need):

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string name="gcm_defaultSenderId">12345</string>
  <string name="google_app_id">12345</string>
</resources>

If you have more than one Strings.xml file, which can happen in case you are using multi-language support, add the two strings to all Strings.xml files to avoid possible errors.

Do not forget to give Rebuild in the project after modifying these files.

    
13.07.2017 / 19:14