Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot resolve symbol 'MyGcmListenerService' and 'MyInstanceIDListenerService'

I'm new to android app developing and I'm following these step from Set up a GCM Client App on Android in the line 29,36 it keep saying cannot resolve symbol MyGcmListenerService and cannot resolve symbol MyInstanceIDListenerService.

  <service
        android:name="com.example.MyGcmListenerService" <<<<<<<<<<<<<<<<<<<<<this
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        </intent-filter>
    </service>
    <service
        android:name="com.example.MyInstanceIDListenerService" <<<<<<<<<<<<<<<<<<<<<this
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.android.gms.iid.InstanceID"/>
        </intent-filter>
    </service>

Do I have to make these files ? and how to make the file ? or another way how to solve this problem

I'm really sorry if this question is too simple, but I have been stuck with this problem for a few days so I really appreciate for all the answers

like image 643
Kitsakorn P Avatar asked Sep 01 '15 06:09

Kitsakorn P


1 Answers

You have to write your own Java class for MyGCMListenerService and MyInstanceIDListenerService, and include it under Manifest.xml like this.

<service
    android:name="<package-name>.MyGcmListenerService"
    android:exported="false" >
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    </intent-filter>
</service>

<service
    android:name="<package-name>.MyInstanceIDListenerService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.gms.iid.InstanceID"/>
    </intent-filter>
</service>
like image 56
capt.swag Avatar answered Nov 09 '22 12:11

capt.swag