Cannot resolve symbol 'GoogleCloudMessaging' GCM

前端 未结 6 1604
遇见更好的自我
遇见更好的自我 2020-12-03 03:09

I am trying to get GCM working in my app (to notify users when our hours change, or when we have any promos going on), but I keep getting the error Cannot

6条回答
  •  一向
    一向 (楼主)
    2020-12-03 03:22

    The sections below guide you through the process of setting up a GCM implementation. Before you start, make sure to set up the Google Play Services SDK. You need this SDK to use the GoogleCloudMessaging methods. Strictly speaking, the only thing you absolutely need this API for is upstream (device-to-cloud) messaging, but it also offers a streamlined registration API that is recommended.

    Did you set up the Google Play Services SDK?

    You have to :

    1. Install the Google Play services SDK
    2. Reference the /extras/google/google_play_services/libproject/google-play-services_lib/ library project in your Android project.

    To install the Google Play services SDK for development:

     1. Launch the SDK Manager.
         - From Eclipse (with ADT), select Window > Android SDK Manager.
         - On Windows, double-click the SDK Manager.exe file at the root of the Android
           SDK directory.
         - On Mac or Linux, open a terminal and navigate to the tools/ directory in 
           the Android SDK, then execute android sdk.
     2. Install the Google Play services SDK.
        Scroll to the bottom of the package list, expand Extras, select Google Play 
        services, and install it. 
        The Google Play services SDK is saved in your Android SDK environment at
        /extras/google/google_play_services/.
     3. Install a compatible version of the Google APIs platform. 
        If you want to test your app on the emulator, expand the directory for
        Android 4.2.2 (API 17) or a higher version, select Google APIs, and
        install it. Then create a new AVD with Google APIs as the platform target. 
        Note: Only Android 4.2.2 and higher versions of the Google APIs platform
        include Google Play services.
    

提交回复
热议问题