manifest merger failed with multiple errors, see logs” - android

I just made an app for notification, and when I run it, it shows
"manifest merger failed with multiple errors, see logs”.
I already clean and rebuild project. But not work. And the log cat is too large so I can't include it.
Manifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:replace="android:icon"
package="shiweichen22gmail.notification">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="shiweichen22gmail.notification.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission android:name="shiweichen22gmail.notification.permission.C2D_MESSAGE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label= "#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity" android:label="#string/app_name" android:theme="#style/AppTheme">
<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.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="shiweichen22gmail.notification"/>
</intent-filter>>
</receiver>
<service android:name=".GCMPushReceiverService" android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>
<service android:name=".GCMRegistrationIntentService" android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
</application>
</manifest>

You just need to add this lines in AndroidManifest.xml.
<permission
android:name="your_package.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="your_package.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<receiver
android:name="your_package.NotificationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="your_package" />
</intent-filter>
</receiver>

Related

FCM Notifications: SecurityException: Not allowed to start service Intent

I'm trying to get a Xamarin.Android app to test out using of FCM for different types of communications, and I've been able to get everything set up but when i attempt to get a registration token for my Visual Studio Emulator - Android (Marshmallow), i'm getting this error..
java.lang.SecurityException: Not allowed to start service Intent {
act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms
(has extras) } without permission
com.google.android.c2dm.permission.RECEIVE 04-12 11:43:44.679
E/FirebaseInstanceId( 1793):
This is my Android.manifest - full contents out of obj\debug
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.fqtrs.xamtest" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<!--suppress UsesMinSdkAttributes-->
<uses-sdk android:minSdkVersion="16" />
<!-- This app has permission to register with GCM and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.c2dm.permission.SEND" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required to wakeup the device and deliver messages -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="net.fqtrs.xamtest.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="net.fqtrs.xamtest.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="FCMNotifications" android:name="android.app.Application" android:allowBackup="true" android:icon="#drawable/icon" android:debuggable="true">
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" 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="net.fqtrs.xamtest" />
</intent-filter>
</receiver>
<activity android:icon="#drawable/icon" android:label="FCMNotifications" android:name="md50b8cb7a267d8690e7668352ad20476c5.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="md50b8cb7a267d8690e7668352ad20476c5.MyFirebaseIIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name="md50b8cb7a267d8690e7668352ad20476c5.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="2147483647" android:authorities="net.fqtrs.xamtest.mono.MonoRuntimeProvider.__mono_init__" />
<!--suppress ExportedReceiver-->
<receiver android:name="mono.android.Seppuku">
<intent-filter>
<action android:name="mono.android.intent.action.SEPPUKU" />
<category android:name="mono.android.intent.category.SEPPUKU.net.fqtrs.xamtest" />
</intent-filter>
</receiver>
<provider android:authorities="net.fqtrs.xamtest.firebaseinitprovider" android:name="com.google.firebase.provider.FirebaseInitProvider" android:exported="false" android:initOrder="100" />
<!-- FirebaseMessagingService performs security checks at runtime,
no need for explicit permissions despite exported="true" -->
<service android:name="com.google.firebase.messaging.FirebaseMessagingService" android:exported="true">
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar" android:exported="false" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
I can't figure out what is wrong with it. Anyone have any ideas?

Some device dont's receive push notification

I implemented GCM push notification with play services 8.4 and sending via php with high priority.
In my Android 4.3 I receive the message, even if after a few minutes while a J5 Samsung with Android 5.1 can take several hours and sometimes is not even received.
I followed the google implementation guidelines for the gcm.
In diagnosing GCM for the J5 of the message tracking token it is indicated as received by GCM but nothing else.
J5 on other applications (whatsapp) receive notifications even in standby but not mine. Now it is as I seek solutions.
I tried through alarm to wake up the manager app to input this, I tried with all the mechanisms suggested by Google but nothing.
I found the information about it of 'HeartBeat but I understood that only decreases the contact time (from 28 minutes to as many as you want in a mobile connection) of the device to the GCM but the situation would not change.
I do not care if the message comes after one hour, but the important thing is to arrive before my death.
Help!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.customer.myapp"
android:installLocation="auto"
android:versionCode="20"
android:versionName="1.4.4" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="23"/>
<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="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"
/>
<permission android:name="com.customer.myapp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.customer.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="23"/>
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"
android:maxSdkVersion="23"/>
<application
android:allowBackup="true"
android:icon="#drawable/main_logo"
android:label="#string/app_name"
android:logo="#drawable/main_logo" >
<activity
android:name=".Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- .GcmBroadcastReceiver, Aggiunto exported -->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.customer.myapp" />
</intent-filter>
</receiver>
<service
android:name=".MyGCMListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name=".MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<receiver
android:name=".Boot"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".FBActivity"
android:label="#string/title_activity_fb"
android:parentActivityName=".Main" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.customer.myapp.Main" />
</activity>
<activity
android:name="com.facebook.LoginActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
<provider
android:name="com.facebook.NativeAppCallContentProvider"
android:authorities="com.facebook.app.NativeAppCallContentProviderXXXXXXXXX"
android:exported="true" />
<receiver android:name=".FacebookBroadcastReceiver" >
<intent-filter>
<action
android:name="com.facebook.platform.AppCallResultBroadcast" />
</intent-filter>
</receiver>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name=".WebviewAct"
android:label="#string/title_activity_webview"
android:parentActivityName=".Main" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.customer.myapp.Main" />
</activity>
<activity
android:name=".ArgomentiActivity"
android:label="#string/title_activity_argomenti"
android:parentActivityName=".Main" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.customer.myapp.Main" />
</activity>
<activity
android:name=".Luoghi"
android:label="#string/title_activity_luoghi" >
</activity>
<activity
android:name=".InfoActivity"
android:label="#string/title_activity_info" >
</activity>
<service android:name=".RegistrationIntentService"
android:exported="false"></service>
<receiver android:process=":remote" android:name=".BroadcastFormyapp">
</receiver>
<receiver android:name=".AutoStart">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<service
android:name=".ServiceAlarm"
android:enabled="true"
> <!-- android:process=":" -->
</service>
<service
android:name=".GcmIntentService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
</application>
</manifest>
Payload in PHP:
$fields=array(
"registration_ids"=>$registration_ids,
"delay_while_idle" => true,
"priority" => "high",
"data"=>$message
);

Android Parse Push notication showing can't find any register device

I am new for parse.com and trying push notification. so i refer this tutorial
http://www.androidhive.info/2015/06/android-push-notifications-using-parse-com/
i changed the application ID and client key also. i am using push notification as a test purpose. but Parse.com showing "Can't find any registered devices yet..." though i installed it in device.
I did same as the tutorial.
My Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.samplepushnotificationparse">
<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.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.example.samplepushnotificationparse.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.samplepushnotificationparse.permission.C2D_MESSAGE" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
<service android:name="com.parse.PushService" />
<receiver
android:name=".CustomPushReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</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.permission.RECEIVE" />
<action android:name="com.google.android.c2dm.permission.REGISTRATION" />
<category android:name="com.example.samplepushnotificationparse" />
</intent-filter>
</receiver>
</application>

Parse deviceToken empty after ParseInstallation save

I am working on an app where I use Parse to send and receive notifications. The problem now is that when I register an installation deviceToken is empty (deviceType and installationId aren't empty). When this token is empty I can't receive any notifications.
How I register the installation:
Parse.initialize(this, "x", "x");
ParseInstallation.getCurrentInstallation().saveInBackground();
When I added all the code for Parse to my app (https://www.parse.com/apps/quickstart#parse_push/android/native/existing) everything was working fine.
My AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx" >
<uses-sdk android:maxSdkVersion="17" />
<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" />
<permission android:protectionLevel="signature"
android:name="com.xxx.xxx.permission.C2D_MESSAGE" />
<uses-permission android:name="com.xxx.xxx.permission.C2D_MESSAGE" />
<application
android:name="com.xxx.xxx.Name_"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:logo="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="#xml/global_tracker" />
<activity
android:name="com.xxx.xxx.Activities.SplashActivity_"
android:screenOrientation="portrait"
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="com.xxx.xxx.Activities.LoginActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.xxx.xxx.Activities.ForgotPassword_"
android:screenOrientation="portrait"
android:label="#string/app_name">
</activity>
<activity
android:name="com.xxx.xxx.Activities.MainActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.xxx.xxx.Activities.EditProfile_"
android:screenOrientation="portrait"
android:label="#string/edit_profile" >
</activity>
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
<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=".Receiver.MyPushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</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" />
<category android:name="com.xxx.xxx" />
</intent-filter>
</receiver>
</application>
</manifest>
I just created a new application, added Parse and deleted the Installation class/table in Parse but still no deviceToken.
I think it's a bug in the new Parse SDK. I downgraded to 1.9.0 and everything works fine now.
Source: https://groups.google.com/forum/#!topic/parse-developers/a1Z0SSC304M

Push Notification receiver android( manifest?)

I am using google push notifications, it worked perfectly until now,
At the moment the push notifications doesnt work beacause onRegistered is never launched. I think the problem is in the manifest(since the problem is that the receiver is never called) but I'm not sure
this is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.name.name"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.name.name.permission.C2D_MESSAGE" android:protectionLevel="normal" />
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.name.name.Disclaimer"
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="com.name.name.Pago"
>
</activity>
<activity android:name="com.name.name.MainActivity" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.NoMiembros" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.ZonaMiembros" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.PlayvideofromserverActivity" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.GoPromo" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.PantallaCarga" android:screenOrientation="portrait"></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.name.name" />
</intent-filter>
</receiver>
<receiver android:name=".SMSHandler$MessageReceiver" android:exported="true">
<intent-filter android:priority="999">
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>
Try changing this :
<uses-permission android:name="com.name.name.permission.C2D_MESSAGE"
android:protectionLevel="normal" />
To this :
<permission android:name="com.name.name.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.name.name.permission.C2D_MESSAGE" />
i'm not sure where the crossover stops, but i'm using C2DM instead of GCM still, and I'm declaring my message and registration receivers as local classes, not pointing to the google classes like you are.
<receiver
android:name=".utils.C2DMRegistrationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" >
</action>
<category android:name="package.name.here" />
</intent-filter>
</receiver>
<receiver
android:name=".utils.C2DMMessageReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" >
</action>
<category android:name="package.name.here" />
</intent-filter>
</receiver>

Categories

Resources