-1

Is it feasible to make our Android application completely transparent (as if its not active at all) and work on the other apps?

My Requirement:

First last an app and after some few settings, make it transparent. Once its transparent, the user will not know that this app is active, however, our app should respond to only specific controls.

This is because of the Broadcast receiver limitation, I will have to use the Volume button for some actions in my application. But, this button doesn't broadcast. So, currently I am using Power button which is not the requirement.

Please throw some light on this. I did some research but, couldnt find any. :(

LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114

1 Answers1

1

This is because of the Broadcast receiver limitation, I will have to use the Volume button for some actions in my application. But, this button doesn't broadcast.

I am not sure it this is right. If you read Android BroadCastReceiver for volume key up and down question, it seems that you can detect it in BroadCastRceiver. I've never tried but it might be worth a try. Do something like following:

In your BroadcastReceiver onReceive function, do something like following:

public void onReceive(Context arg0, Intent intent) {
    if (intent!=null){
        int volume = (Integer)intent.getExtras().get("android.media.EXTRA_VOLUME_STREAM_VALUE");
        // Get the old volume from the SharedPOreferences
        // volume variable contains the current volume
        // Compare it to the old value saved. If it is greater than old value then user pressed the UP Volume button else DOWN volume.

    }
}

Also I am not sure that you can make it transparent and still keep it running. You can have a background of an activity as transparent though. How do I create a transparent Activity on Android?. Hope it helps.

Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124