I had error on the manifest file when I tried to solve the GCM issue :
error
error: Error: No resource found that matches the given name (at 'label' with value '#string/title_activity_main').
The error appears here:
android:label="#string/title_activity_main" >
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.elarabygroup"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<permission
android:name="com.example.elarabygroup.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.elarabygroup.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<service
android:name="com.example.elarabygroup"
android:enabled="true" />
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
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="com.example.elarabygroup.gcm2" />
</intent-filter>
</receiver>
</application>
</manifest>
Please add #string/title_activity_main to your string resources.
You should have the string in the res/values/strings.xml as an item:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="title_activity_main">My Main Activity</string>
</resources>
Related
I build a push client app using Parse.com SDK.
I can receive push messages on Nexus 5 and 7 which both have Android OS v4.4.2.
But I can't receive push messages on older devices like Samsung Galaxy Ace (v2.3.5)
Here is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="9" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission
android:name="com.me.myapp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.me.myapp.permission.C2D_MESSAGE" />
<application
android:name="WolApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.me.myapp.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>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.GcmBroadcastReceiver"
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" />
<!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. -->
<category android:name="com.me.myapp" />
</intent-filter>
</receiver>
<receiver
android:name="com.me.myapp.MyCustomReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.me.myapp.UPDATE_STATUS" />
</intent-filter>
</receiver>
</application>
</manifest>
GCM server side is working fine. GCM Client side is working fine for emulator but not for device.
GCM SERVICE IS WORKING FINE FOR EMULATOR.
Below is my manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spidertechnologiesllp.yay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Creates a custom permission so only this app can receive its messages. -->
<permission
android:name="com.spidertechnologiesllp.yay.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.spidertechnologiesllp.yay.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="#drawable/yayicon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.spidertechnologiesllp.yay.YayTabActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".GcmBroadcastReceiver"
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="com.spidertechnologiesllp.yay" />
</intent-filter>
</receiver>
<service
android:name=".GCMNotificationIntentService"/>
<activity
android:name="com.spidertechnologiesllp.yay.YayPredictionActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.spidertechnologiesllp.yay.YayOptionsActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.spidertechnologiesllp.yay.YayLoginActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity android:name="com.facebook.LoginActivity" >
</activity>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
</application>
</manifest>
STRUGGLING SINCE 2 DAYS.
ANY HELP WOULD BE APPRECIATED !!!
Youdint not place permission in com.spidertechnologiesllp.permission is missing
Replace this in manifest file
<permission
android:name="com.spidertechnologiesllp.yay.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
I have started working on GCM Notification
after a lot of goggling i checked out code through which i can get registration id from GCM Server so i used
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId= GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, "338056690461");
}
else{
Log.v(TAG, "Already registered");
}
But When i run My Application i get error on `CheckMAnifest()`
this means i have error in my manifest but accordint to me my manifest is correct please have alook to my Exception as well as manifest
Exception it gives
java.lang.IllegalStateException: Application does not define permission PushNotification.Pop.permission.C2D_MESSAGE
and manifest i have used is
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="PushNotification.Pop"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<permission
android:name="PushNotification.Pop.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="PushNotification.Pop.permission.C2D_MESSAGE" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:debuggable="true" android:label="#string/app_name" >
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
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="PushNotification.Pop" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>
Please suggest me where i am going wrong your help would be greatfull
Thanks in advance :)
try to copy and paste this
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="PushNotification.Pop"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="17"/>
<!-- GCM connects to Internet Services. -->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="PushNotification.Pop.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="indieswebs.magento.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<application android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
>
<activity android:name="PushNotification.Pop.MainActivity"
android:label="#string/app_name_title"
android:clearTaskOnLaunch="true"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="PushNotification.Pop" />
</intent-filter>
</receiver>
<service android:name="PushNotification.Pop.GCMIntentService" />
</application>
</manifest>
or
I got answer for this issue. Just delete "gen"folder . It build automatically. Application will work fine.
Im using novoda project to use a jar gps locator (https://github.com/novoda/Novocation)
with so I keep on getting the same error on the manifest file -
"attribute is missing the android namespace prefix", Cant figure out why, ideas? thats a really big bummer since by the documentation and the sample app I can really use his gps locator...
Here Is my manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mappermate"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="13" />
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.CALL_PHONE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:name="com.mappermate.application.MappermateApp"
android:icon="#drawable/ic_launcher"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<uses-library android:name="com.google.android.maps" />
<!-- Uploader Activity -->
<activity android:name="com.mappermate.ui.phone.UploaderActivity" >
</activity>
<!-- Login Activity -->
<activity android:name="com.mappermate.ui.phone.LoginActivity" />
<!-- Register Activity -->
<activity android:name="com.mappermate.ui.phone.RegisterActivity" />
<!-- Authentication Activity -->
<activity android:name="com.mappermate.ui.phone.AuthenticationActivity" />
<!-- Exit Activity -->
<activity android:name="com.mappermate.ui.phone.ExitActivity" />
<!-- Main Menu Activity -->
<activity android:name="com.mappermate.ui.phone.Delete_MainMenuActivity" />
<!-- Preferences Activity -->
<activity
android:name="com.mappermate.ui.phone.PreferencesActivity"
android:theme="#style/PreferencesTheme" >
</activity>
<!-- My Location Activity -->
<activity
android:name="com.mappermate.ui.phone.MapperMateScreen"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.novoda.location.receiver.ActiveLocationChanged" >
<intent-filter>
<action android:name="com.novoda.location.ACTIVE_LOCATION_UPDATE_ACTION" />
</intent-filter>
</receiver>
<receiver android:name="com.novoda.location.receiver.PassiveLocationChanged" />
<receiver
android:name="com.novoda.location.receiver.RestorePassiveListenerOnRestoredConnectivity"
enabled="false" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<receiver android:name="com.novoda.location.receiver.StopPassiveLocationUpdatesOnLowBattery" >
<intent-filter>
<action android:name="android.intent.action.BATTERY_LOW" />
<action android:name="android.intent.action.BATTERY_OKAY" />
</intent-filter>
</receiver>
<receiver android:name="com.novoda.location.receiver.RestorePassiveListenerBoot" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
What I can see wrong is
enabled="false"
needs to be
android:enabled="false"
In addition, you need to add
</manifest>
at the end of your manifest.
I'm using one device for testing and I'm getting a lot of new registration IDs from it. Not every time the app is built, but sometimes. I'm not sure what the deal is. How do I get it to use the same id? Isn't that what is supposed to happen?
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="company.android.phone.TheApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<!-- for push notifications -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- For performance testing a trace file is saved to the SD card -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<permission android:name="company.android.phone.TheApp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="company.android.phone.TheApp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<supports-screens
android:resizeable="true"
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="false"
android:anyDensity="true" />
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name" >
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="company.android.phone.TheApp" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="company.android.phone.TheApp" />
</intent-filter>
</receiver>
<activity
android:name=".SplashActivity"
android:theme="#style/Theme.Splash"
android:screenOrientation="portrait"
android:noHistory="true" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="#string/app_name"
android:windowSoftInputMode="stateVisible|adjustPan"
android:name=".TheAppActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".MainActivity"
android:windowSoftInputMode="stateVisible|adjustPan"
android:screenOrientation="portrait" />
<activity android:name=".WebViewActivity"
android:windowSoftInputMode="stateVisible|adjustPan"
android:screenOrientation="portrait" />
<service android:name=".GCMIntentService" />
</application>
</manifest>
You have no warranty that your Registration Id will always be the same for your device.
The registration ID lasts until the Android application explicitly
unregisters itself, or until Google refreshes the registration ID for
your Android application.
For more info look here "Enabling GCM":
http://developer.android.com/guide/google/gcm/gcm.html