'Programmatically register/deregister intent-filter for an activity
Assume that I have app X, with Activity A which is launched by some intent filer F defined in X's manifest file.
Is it possible for X to programmatically deregister/register intent filter F for A?
Is is possible for another app Y to programmatically deregister/register intent filter F for A, given that I have access to both app X and Y and can set any required permissions?
Solution 1:[1]
For example, if two applications need to communicate with one another, they can do so by using the object type Binder instead of using complex protocols ICP.
- Each application for security reasons should be signed with the same key,
- Each application should be run always with the same user identifier.
- Declare all the relevant activities or components
Solution 2:[2]
You can not register / Deregister intent-filter
programatically. But what you can use Broadcast Receiver
for the same purpose. Something like :
registerReceiver(this.broadcastReceiver, new IntentFilter("android.provider.Telephony.SMS_RECEIVED"))
and Unregister it like :
if (this.broadcastReceiver != null) {
unregisterReceiver(this.broadcastReceiver);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Stanojkovic |
Solution 2 | Gaurav Rajput |