I am trying to send push notification(FCM) to my android app using this link.Everthying works fine when the app is in background but once i kill the app then i dont receive any notofication.I use Lenovo Tab with Android 7.1 OS.I also tried signing the app and installing as APK.Below is my gradle file and logcat output :-
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="YOUR NOTIFICATION CHANNEL NAME"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="#android:color/white"/>
<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.liappmanager" />
</intent-filter>
</receiver>
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name=".FirebaseIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
logcat output :-
03-02 12:00:15.673 1489 1536 W BroadcastQueue: Unable to launch app
com.liappmanager/10279 for broadcast Intent {
act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010
pkg=com.liappmanager (has extras) }: process is not granted
03-02 12:00:15.676 2369 2369 W GCM : broadcast intent callback:
result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE
flg=0x10000000 pkg=com.liappmanager (has extras) }
As you can see from logcat i understood the permission is not granted but i added the permission in gradle file.Am i still missing something regarding permission.
[SOLVED]:Finally i solved it if your using Lenovo Just go to Settings->Battery Optimization -> All apps -> {YOUR APP} -> Don't Optimize(Check it) that's it this(restart the device), will solve the problem for further reference check this .
Related
<application
<service
android:name="org.jitsi.meet.sdk.ConnectionService"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.telecom.ConnectionService" />
</intent-filter>
</service>
</application>
I am adding in my android manifest but launcher(splash) screen black
I'm rebooting the phone and I expect a log message. I've registered the BroadcastReceiver in Androidmanifest, but no message is being received. What am I Missing?
androidmanifest:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Receives an event when the device has completed a reboot -->
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.BOOT" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
BootReceiver:
class BootReceiver : BroadcastReceiver() {
override fun onReceive(p0: Context, p1: Intent) {
Log.i("BootReceiver", "Boot event received")
}
}
When I filter in the logging for "boot" I see several other apps logging the event, but not my own App:
I/NU.LockBootCompleteReceiver: onReceive : Intent { act=android.intent.action.LOCKED_BOOT_COMPLETED flg=0x89000010 cmp=com.samsung.android.app.telephonyui/.netsettings.ui.receiver.LockBootCompleteReceiver (has extras) }
I/BCL#CoreSvc: (CoreServiceComponentEnabler) updateComponent() : class com.samsung.android.bixby.receiver.token.BootCompleteReceiver | 2
I/BCL#CoreSvc: (CoreServiceComponentEnabler) updateComponent() : class com.samsung.android.bixby.receiver.token.LazyBootCompleteReceiver | 1
I/CIDManager: [onReceive(BootReceiver.java:20)] onReceive: android.intent.action.LOCKED_BOOT_COMPLETED
I/ActivityManager: Start proc 7201:com.samsung.android.game.gametools/u0a79 for broadcast {com.samsung.android.game.gametools/com.samsung.android.game.gametools.floatingui.receiver.GameBoosterBootCompleteReceiver}
I/GameTools: BootCompleteReceiver already enabled.
I/GameTools: GameBoosterBootCompleteReceiver: onReceive: Intent.ACTION_LOCKED_BOOT_COMPLETED
I/GameTools: GameBoosterBootCompleteReceiver: clear runtime settings on boot complete.
I/GameTools: GameBoosterBootCompleteReceiver: register Intent.ACTION_USER_UNLOCKED
I/GameTools: GameBoosterBootCompleteReceiver: register Intent.ACTION_USER_UNLOCKED via EventDelegationManager
I/ORC/FbeBootReceiver: onReceive : android.intent.action.LOCKED_BOOT_COMPLETED
I/ORC/FbeBootReceiver: FBE islocked : true
I/CS/MsgFMMReceiverService: PCW LOCK. handlePCWLockMessage. LockedBootComplete : true
I/CS/xmsFbeJobService: onLockedBootCompleted()
I/ORC/FbeMigrationJobService: onLockedBootCompleted()
I/StateUtils: isDirectBootMode On : true
I/PackageManager: !#Start postBootUpdate
I/PackageManager: !#Finish postBootUpdate dexopted: 3
Remove:
<category android:name="android.intent.category.DEFAULT"/>
Categories are normally only used on activities, not broadcasts.
The code above is working fine.
I have checked on device ->
google pixel 4a, os 12
mi a1, os 11
i am able to see logs every time i reboot my device.
Try changing your device and test.
check the manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.MyApplication">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.BOOT" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
</application>
</manifest>
Hi im working with MOCA SDK,
all works but when I try to receiver action notification,
the app show me:
06-07 15:28:43.025 479-493/? W/BroadcastQueue: Permission Denial:
broadcasting Intent { act=com.moca.push.ACTION_PUSH_RECEIVE
dat=intent://moca/action/PQH24yPZTMuE8juAh2uxEw flg=0x10
cmp=com.procibernetica.moca/com.innoquant.moca.push.MOCAPushReceiver
bnds=[63,290][657,375] (has extras) } from com.procibernetica.moca
(pid=-1, uid=10109) requires com.google.android.c2dm.permission.SEND
due to receiver
com.procibernetica.moca/com.innoquant.moca.push.MOCAPushReceiver
<receiver
android:name="com.innoquant.moca.push.MOCAPushReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.innoquant.moca.push.ACTION_PUSH_RECEIVE" />
<action android:name="com.innoquant.moca.push.ACTION_PUSH_DISMISSED" />
</intent-filter>
</receiver>
<receiver
android:name="com.innoquant.moca.push.GcmPushReceiver"
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.procibernetica.moca" />
</intent-filter>
</receiver>
At the moment I can't find the solution, if any one have a suggestion or response, I really appreciate this
Hi I was following the android push notification tutorial, and my application just freezes when I run it and then a time out occurs. But in the application class, if I remove ParsePush.subscribeInBackground, application runs properly. And my application only has one activity that prints hello world. Thanks for help.
My manifest is :
<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.ParsePushBroadcastReceiver"
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" />
<!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. -->
<category android:name="com.swipeit.swipeit" />
</intent-filter>
</receiver>
Application.java
public class Application extends android.app.Application {
public Application() {
}
#Override
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(this);
Parse.initialize(this, "TXLfgM7jiXbdeeQQin5CMy7tQHpZ3mXKhVh2Rb7o", "6tRKnMrAlkYeCCP7JO4p4qmzsr2kDctCafno5f5i");
ParsePush.subscribeInBackground("", new SaveCallback() {
#Override
public void done(com.parse.ParseException e) {
if (e == null) {
Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push", e);
}
}
});
// ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
That's the logcat I am getting:
1658-1658/com.google.android.gms I/ConfigFetchService﹕ fetch service done; releasing wakelock
03-02 11:35:23.910 1658-1658/com.google.android.gms I/ConfigFetchService﹕ stopping self
03-02 11:35:23.920 1801-1801/com.google.process.gapps I/ConfigService﹕ onDestroy
03-02 11:35:24.060 1312-1330/system_process W/ActivityManager﹕ Launch timeout has expired, giving up wake lock!
03-02 11:35:25.910 1312-1336/system_process W/BatteryStatsImpl﹕ Couldn't get kernel wake lock stats
03-02 11:36:00.020 1312-1330/system_process I/ProcessStatsService﹕ Prepared write state in 0ms
03-02 11:36:00.070 1312-1329/system_process I/ProcessStatsService﹕ Pruning old procstats: /data/system/procstats/state-2015-02-07-22-15-38.bin
try this
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- IMPORTANT: Change "com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" in the lines below to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission
android:name="in.appera.generalQuiz.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="in.appera.generalQuiz.permission.C2D_MESSAGE" />
<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: If you change the package name of this sample app,
change "com.parse.tutorials.pushnotifications" in the lines
below to match the new package name.
-->
<category android:name="in.appera.generalQuiz" />
</intent-filter>
</receiver>
I really do not know what is wrong, but my if widget is update by system by "APPWIDGET_UPDATE" it throws following exception. I tried several things, exporting receiver (true/false), I tried it on emulators and real phones, but it is same. I added several intent-filters, but it did not work.
11-06 20:10:10.279: W/ActivityManager(61): Permission denied: checkComponentPermission() reqUid=1000
11-06 20:10:10.279: W/ActivityManager(61): Permission Denial: broadcasting Intent { act=android.appwidget.action.APPWIDGET_UPDATE (has extras) } from com.ency.easychange (pid=1196, uid=10034) requires null due to receiver com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider
My AppWidgetProvider is only declared, because I tried to eliminate possibilities, but the exception is throw before ExchangeRateWidgetProvider.onReceive() is called.
public class ExchangeRateWidgetProvider extends AppWidgetProvider {
public static final String tag = "ExchangeRateWidgetProvider";
#Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
}
}
My Manifest:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- TODO: Remove, only for traces -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:icon="#drawable/ic_launcher_main"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".EasyChange"
android:label="#string/title_activity_easy_change" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".ExchangeRateWidgetService"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
</intent-filter>
</service>
<receiver
android:name=".ExchangeRateWidgetProvider"
android:label="#string/exchange_rate_widget_name"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/exchange_rate_widget_providerinfo" />
</receiver>
<activity
android:name=".WidgetConfigSmall"
android:label="#string/title_activity_widget_config_small"
android:theme="#android:style/Theme.Holo.Dialog"
android:excludeFromRecents="true"
android:exported="true" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>
</activity>
</application>
I appreciate if you can take a look ...
Your problem lies somewhere in your Java code, where you are attempting to send the android.appwidget.action.APPWIDGET_UPDATE broadcast. That is to be broadcast by the OS, not by apps, and that is what the Permission Denial is about.