Android - Launching Activity on top of other Apps
Background: I am trying to build a Launcher app that will restrict users
to a set of permitted applications only and will not allow them to access
device settings & anything other then the permitted apps.
Why: This is a project for a private company to distribute devices to
their employees with restricted usage.
Issue: I am able to detect launch of other apps, but i am not able to
overlay my activity on top of them. Below is the code, i am trying after
receiving broadcast of not allowed app.
private class BadAppReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context arg0, Intent arg1) {
Intent i = new Intent(HomePage.this,ErrorClass.class);
wh.topAct = wh.bad_app;
HomePage.this.startActivity(i);
Toast.makeText(HomePage.this, "Access to " + wh.bad_app + " is
not allowed.",Toast.LENGTH_LONG).show();
}
}
Interesting Fact: I am able to overlay if I just launch another app
instead of trying to open an Activity from my app. Using this solution
will make my app dependent on another app and kind of freezes the screen
for couple of seconds.
Question: What am i missing or can do to pop my Activity over other apps.
Thanks in advance and your help is highly appreciated. - Pratidhwani
No comments:
Post a Comment