BOOT_COMPLETED not triggered on a Gionee device with Lollipop ver - android

UPDATE : I am receiving BOOT_COMPLETED on Gionee but only if I follow these steps -
1. Open "Auto start" and then close it
2. Open the app and close it
If I do above steps and then turn off and on the phone, BOOT_COMPLETED gets triggered. Next time if I just turn it off and on, it is not triggered. Am able to simulate this consistently. What might be the reason ?
I have this declared in the manifest. It is working on phones like Samsung, Motorola etc but on Gionee I found that the receiver is not getting triggered on phone bootup. The phone has Lollipop ver. Please let me know what might be missing here. Appreciate your help.
<receiver
android:name=".BootUpReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="999">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.REBOOT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>

This worked on my Gionee Phone:
<receiver
android:name=".BootUpReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="999">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.REBOOT" />
<action android:name="com.gionee.intent.action.QUICKBOOT_POWERON"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>

Related

How to receive BOOT_COMPLETED on Android TV

I'm developing an app for Android TV. I have a sticky service & a broadcast receiver that should restart this service after system reboot.
The code works perfect for any phone, but, in the case of the TV, any of the actions that I defined in the receiver's intent isn't received, when turning on the TV from standby(using the remote). It works when I unplug the TV and plug it again.
Has anyone tried something similiar? Any advice might help. Thanks
I've tried BOOT_COMPLETED, QUICKBOOT_POWERON, REBOOT, ACTION_POWER_CONNECTED.
Here is the receiver I've configured.
<receiver
android:name=".MyReceiver"
android:directBootAware="true"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"
/>
<action
android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.REBOOT" />
<action
android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<action
android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
Expected to catch the action of turning on the device in the broadcast.
Please check if you have added following permission.
uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"

Cannot receive push when app is killed Parse FCM

I have updated parse sdk which forces me to migrate from GCM to FCM. I have followed this link :
https://github.com/codepath/android_guides/wiki/Push-Notifications-Setup-for-Parse
I am able to receive push notification when app is running or is in background but not when app is killed.
Here is my AndroidManifest.xml :
<service
android:name="com.parse.fcm.ParseFirebaseInstanceIdService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name="com.parse.fcm.ParseFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<receiver
android:name=".receiver.CustomParsePushReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.RECEIVE_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.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</intent-filter>
</receiver>
CustomParsePushReceiver.java
public class CustomParsePushReceiver extends ParsePushBroadcastReceiver {
#Override
protected void onPushReceive(Context context, Intent intent) {
Log.e("ParsePushReceiver","Parse receiver received notification");
}
}
I have updated parse server, parse sdk, parse-fcm, firebase-core and firebase-messaging to latest version.
You need to have a separate receiver for com.parse.ParsePushBroadcastReceiver
Place your other actions (like Boot_Complete) on separate 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>
Some stock ROMs kill all the background processes when the app is killed. Hence the push service is killed and I was not able to receive push when app is killed. Some of those manufacturers are OnePlus, Lenovo, Xiomi, Oppo and Vivo. But when I tested in other devices such as HTC and Samsung it worked !!!
For more info read this blog : https://medium.freecodecamp.org/why-your-push-notifications-never-see-the-light-of-day-3fa297520793

android.intent.action.MY_PACKAGE_REPLACED Not getting triggered

I have this receiver declared in my Manifest file. I am receiving the broadcast in one phone that is Samsung Note 2 Jelly bean but not receiving the broadcast on another phone, Redmi 4.4.4. Please let me know what might be the issue.
<receiver
android:name=".UpgradeReceiver"
android:enabled="true"
android:exported="false">
<intent-filter android:priority="999" >
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
</receiver>

Is it possible to intercept app uninstall?

Is it possible to intercept app uninstall and make some job? E.g. my app modifies some files of device, so it would be neat before uninstalling just rollback changes made by my app.
Any hints, ideas?
Are you talking about the similar issue
Listen Broadcast Before application uninstall
Then as said you have to use the intent-filter for delete as given in the above link.
<activity
android:name=".UninstallIntentActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DELETE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="package" />
</intent-filter>
</activity>
and when you get notified , do whatever you want.

Difference between Android BOOT_COMPLETED & category HOME

I am trying to solve a start on boot related problem and I noticed many examples of the AndroidManifest.xml which has android.intent.action.BOOT_COMPLETED and some that also have the category of android.intent.category.HOME in there. Does anyone know what the difference (if any) between the two are?
ie.
<receiver android:name=".MartiniBootBroadCastReciever"
android:enabled="true" android:exported="false"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
versus
<receiver android:name=".MartiniBootBroadCastReciever"
android:enabled="true" android:exported="false"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
AFAIK, your first one is wrong. The BOOT_COMPLETED broadcast should not have that category, AFAIK.

Categories

Resources