0

I want to protect my activity class to not be allowed to use in another package, for example if have a user homepage activity it is should be able to called only if the user signed in correctly, but the protected is not allowed in android, so how i can do it?

Mohammad
  • 3,449
  • 6
  • 48
  • 75

1 Answers1

3

You can set android:exported="false" for the activity in your manifest:

android:exported
Whether or not the activity can be launched by components of other applications — "true" if it can be, and "false" if not. If "false", the activity can be launched only by components of the same application or applications with the same user ID.

Michael
  • 57,169
  • 9
  • 80
  • 125