android.intent.action.TIME_SET in marshmallow not working - android

I have broadcast receiver for date change event, it works fine for kitkat and lolipop version but not working in marshmallow.
code is as follow
<receiver
android:name=".DateChangedReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.TIME_SET" />
</intent-filter>
</receiver>
what should I do for that? is their any special permission required? Please help

You are right . This intent action may be restricted to system apps only . Adding the android:permission="android.permission.BIND_DEVICE_ADMIN" to the receiver is working for me .
PFB update receiver definition
<receiver
android:name=".DateChangedReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BIND_DEVICE_ADMIN"
>
<intent-filter>
<action android:name="android.intent.action.TIME_SET" />
</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"

BOOT_COMPLETED not triggered on a Gionee device with Lollipop ver

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>

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>

Need package path for RemoteControlReceiver?

I am trying to make an existing android app wearable.
Is it necessary, or not, to specify the full package path for setting a media button event receiver?
I haven't seen any explanation in the official documentation. It is as follows in the documentation:
<receiver android:name=".RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
While I have this in my current code:
<receiver android:name="com.pckg.my.app.subpack.RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
Try to add (.) in the beginning of your android name
<receiver android:name=".com.pckg.my.app.subpack.RemoteControlReceiver">

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