0
votes

I'm trying one of the example for Push notifications in android App with API 19. Here is my AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.jsonclient"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="19"
        android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="com.example.jsonclient.permission.C2D_MESSAGE" />
````    <permission
        android:name="com.example.jsonclient.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".HomeActivity"
            android:label="@string/title_activity_home" >
        </activity>

        <receiver
            android:name=".GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

                <category android:name="" />
            </intent-filter>
        </receiver>

        <service android:name=".GcmIntentService" />
    </application>

</manifest>

Here I added Google Play Services library : enter image description here

enter image description here

Here is my SDK Manager with Google Play Services. enter image description here When executing method

checkPlayServices

I got Error :

The Google Play services resources were not Found. Check your project configuration to ensure that the resources are included.

2
unless im missing it you dont have the required meta-data tag that indicated the version of google play service in your manifesttyczj
you mean I have to add this: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />Ashok
with that I see Error: : No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').Ashok

2 Answers

2
votes

Go to android-sdk folder in your system then extras->google->google_play_services->libproject-> google-play-services_lib

Import google-play-services_lib in your workspace and then add this library project to your own project. Your issue will be hopefully resolved.

1
votes

You cannot only import the .jar file, you need to import the entire library which includes all its resource files.

Please read the documentation on how to setup google play services.

https://developers.google.com/android/guides/setup

Also eclipse is no longer supported move to Android Studio and things will be a lot easier when importing google play services