I'm building an Android App that her purpose to be secret, I dont want the icon will exist in the apps menu.
The idea is that that only the user that installed the app could use it with a private code he configured after installation.
Can I hide my app from the list and run it?
What are my options starting this app by entering kind of code/pattern for that use? and is it possibile to connect to the user lock\unlock system after screen looks and let him set a uniqe code that after entering it he could enter to the app mode.
I'll be happy getting some code or any kind of tutorials
I've seen other apps use a private dialling code/fake phone number to trigger opening a hidden app.
You can register a listener for NEW_OUTGOING_CALL and check the EXTRA_PHONE_NUMBER that is passed with it to cancel the call and open your app if the number matches your private code. Otherwise ignore and let the call go through as normal.
This obviously has permissions for that are needed that may look suspicious to potential users.
As for removing your app from the launcher as other's suggested and as described in the linked Question you need to remove the <intent-filter> from your <activity>
<category android:name="android.intent.category.LAUNCHER" />
Related
I am using Branch.io deeplinking in my Android app, and for the most part, it works well under most scenarios. However, I have a scenario where I register a user (to my service); and in that flow, the user requests an SMS verification code, and thus has to leave the app (minimize) to read it, then re-enter the app (restore) to validate to code.
I had this behavior working perfectly before implementing branch.io, and the reason has to do with Branch.io requiring android:launchMode="singleTask" in the AndroidManifest.xml file (see here).
<activity
android:name="com.yourapp.SplashActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
...
When android:launchMode="singleTask" is removed, the user can leave/enter the app as much as they want and are always returned to the same activity that they were on when they minimized the app. Yet, Branch.io deeplinking is no longer respected.
HOWEVER, it seems that this minimize/restore behaivor is not (?) possible with Branch.io is implemented. Is it? How can I retain the minimize/restore functionality of my app, which implementing Branch.io deeplinking?
In addition to Amruta's comment I wanted to contribute. As singleTask is required for proper deep linking to avoid multiple instances of the same activity, our best workaround/suggestion for this issue which hasn't been mentioned yet is to create a transparent deep linking activity. This way you can set a throw away transparent activity to singleTask, init session from it it -> grab params -> route accordingly. Otherwise you're stuck adjusting your main app flow to our requirement of using singleTask. This tends to be the most popular workaround!
Im trying to understand the ways to override the home button functionality in Android.
Im doing a LockScreen App and the HOME button is unlocking the device.
I have been researching the last 3 days for a way to do it, and all the solutions I have found are not 100% effective (mostly due to the nature of HOME).
I have implemented solutions for all the solutions below in these three days but Im still not satisfied.
Problem:
I want to be able to override the HOME button functionality the same way as the WidgetLocker app in the AppStore.
WidgetLocker is not a home launcher and it still can override the HOME better than anyone.
Link to WidgetLocker App
Disclaimer
First of all, I know that this is a security measure in Android so that an App does not take full control of the device, and I agree with it.
The official way is to implement a home launcher and its my preferred of them all, unfortunately my boss is still not 100% convinced on the path I selected, until I exhaust all other possibilities.
It must be for 4.0+ version of android
Solutions
Implement as Home launcher, catch the HOME intent and take care of home button presses, this has the problem that the user must select the app as the default home launcher and may not understand why (another problem I know, but still)
Implement a Service with a SYSTEM_OVERLAY view that is launched every time the device is locked, being effectively on top of everything, unfortunately (or fortunately security wise) the home button presses are still being sent to the app below and the default home launcher is still called.
Implement an activity parallel to the one that implements the lock screen, that contains the HOME Intent that is activated/deactivated programatically on the my app options, effectively changing the main app to a homelauncher on demand, when this activity is called it launches the lockscreen activity.
Is there any other way to do this?
Thanks in advance.
Look in the following topic for a way to override the home button:
Overriding the functionality of Home Button
Personally though I would suggest going for the option where you implement your own home screen. We use a similair setup where I work. The app we want people to use is set as the default option when the home button is pressed. That way we can control where people can go to a large degree. This options can only be reset by resetting the application defaults of the app. This makes it non-permanent in case a fix to the device is needed.
For the latter implementation just install with the following lines in your manifest
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
Now the next time you press the home button a pop-up will ask you what you want to do.
Working with a restaurant in an android tablet based menu app. If possible I would like to restrict access to just the menu app and browser. How would a I go about turning a normal dashboard app into a launcher replacement???
Add this to your <activity>:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
When the user presses HOME again, they will get a chooser -- check the "make this the default" checkbox, then tap the entry for your app, and you're now the home screen.
Bear in mind, though, that:
If you let users get to a browser, they will be able to download and run apps distributed publicly, plus click links that might lead to other apps on the device (e.g., YouTube, a PDF reader)
If the user knows how to boot your device in safe mode, the firmware home screen will return; the only solution to this is to have your home screen be installed on the firmware of the device
There is a Home sample project in your SDK that demonstrates more of this.
You can write a simple app that allows the user to start 2 different apps (the menu and the browser) using intents while never ending your main app. In that app/launcher app you can override the home/back button in such a way that it will not allow the user to quit that app/launcher. This means that once the app is started there is no way to stop it, except by turning the tablet off.
I am using some home replacement that allow me to hide the notification Bar and that's something I really like.
All the informations can be replaced by some widgets, but I would like to display the notifications too.
As I already developed some applications, I would like to know if there is a command line that allow an application to get all the notifications. I plan to add this to a widget or a toast.
Thank a lot for any clue or help.
Since Android API Level 18 (Android 4.3) there is a class NotificationListenerService.
You must set the Permission BIND_NOTIFICATION_LISTENER_SERVICE and use a intent-filter with the action NotificationListenerService.
<service android:name=".NotificationListener"
android:label="#string/service_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
Source: http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications()
I will answer my question because I found something on an other forum.
Seem that you can access them declaring your application as an (sorry for the french term, I couldn't find an english translation) "gestionnaire d'accessibilité" that you may translate as "accessibility manager"
More information here: https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html
That may be dangerous and has a lot of negative point, but an other dev that is also working on a custom Home assure me that this feature work and he was able to create his own notification bar.
In my Android app, I have a main activity that serves as an entry point to my application, which is configured in my manifest file like this :
<activity android:name=".Main"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:alwaysRetainTaskState="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
So for a particular use case, lets say a user starts up the app from the home screen by clicking the icon inside the application launcher. After starting the app, the user navigates from the Main activity to activity A and then finally to activity B. At this point, the user decides to check their facebook, so they click the home button to put my app in the background, and launches the facebook app.
After checking their facebook, the user wants to return to my app, so they press the home key, and launch the application from the application launcher (just like they did the first time it was launched).
When a user returns to my app, I want the app to return to the last activity the user was at when the app was put into the background, which in this case is activity B. In the manifest file, I have set alwaysRetainTaskState=true to make sure the OS doesn't kill my app's activities.
Now to my question: how do I get the behavior I described above? Whenever I click my app's icon, it always starts at the Main activity, no matter what. I think this is because of the category.LAUNCHER attribute. I have tried android:launchMode=singleTask, but it hasn't made a difference; it always starts at Main.
If someone could clarify intent filters, launch modes, and tasks, that would be great!
FYI singleTask is not what you want, since it starts a new task:
http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
How are you launching Activity B? Any non-standard launch modes or Intent flags?
For anyone coming here with similar problems, I found something strange that might be what you are seeing... maybe.
Say I have an app with activities A -> B -> C etc. I was having issues with my app always "resuming" to A if it was launched from the app list aka launcher. Resuming from the "resents" screen (long home press) would exhibit correct resume behaviour though (resume to B or C as expected). My manifest was nothing special, I have alwaysRetainTaskState="true" set in my root activity, and launch mode is default (standard).
I was loading the apk onto my phone via a website. After downloading and installing, I would press "Open" to launch the app right away. For some reason (after uninstalling the app) I tired downloading again, installing, but then I pressed the "Done" button instead. Then Launching the app from the launcher/"all apps" list has the same resume behaviour as resuming from recents - in other words my problems were being caused somehow because of the installation process when clicking "Open" instead of "Done".
I verified this "solution" on API10 (2.3.5) and API15 (4.0.4)
I solved this by adding the screenless DispatcherActivity and making it the default one (by using the very same intent filter). In its onCreate method you create and call the Intent based on some reasonable default (your Main activity for example) OR based on some saved token that identifies which Activity should be started. That token is saved/refreshed in onStop method of any Activity you want to call on restart. You can save this token to Preferences.
The rational here is that last activity that was visible will execute onStop method when interrupted.
Word of caution here: I did implement this pattern and it worked reasonably well. However it seems not play too well with history and finally I just gave up and yanked this code out. Nobody complained so far.