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?
Asked
Active
Viewed 1,514 times
0

Mohammad
- 3,449
- 6
- 48
- 75
-
Are you talking from end-user perspective or development perspective? – Tobrun Oct 03 '13 at 12:43
-
development perspective. – Mohammad Oct 03 '13 at 12:44
-
Maybe I'm misunderstanding you but this sounds like a simple if,else block in your code. – DroidT Oct 03 '13 at 12:53
1 Answers
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