I want my app automatically open when user click (for example) chrome or any other apps.
How to do this?
My app is for preventing people use cell phone all the time.
Explicitly, there is a mission in my app. when user starts this mission, user cannot use other app until they give up the mission.
User can minimize my app, but when user click another app, my app will prompt programmatically to tell user not to use the cell phone.
Instead of preventing user to launch other apps, I think you should use activities' life cycle. You can add code in onPause() and detect user press home button or back button. And when your activity is not on foreground, you can pop a dialog or something to remind your user focus on his work not his phone. BTW I do see the positive side of your app.
Related
I need to know what can I do with my app if the user changes my app to default assist app.
I'd like to know what abilities this role grants, preferably with the source of the information.
I know that this will make your application start when 3 things happen:
When the user long-clicks the home button in the navigation bar
When the user presses the assistant button on their Device ( if their device has it )
when an another application starts the assist app ( your app ) using this code: startActivity(new Intent("android.intent.action.VOICE_COMMAND"));
If I have a restaurant app for example that just orders some food. Is it possible to detect when one of my app users enters the store and then the app does something? For example when the user comes in the app sends a notification or opens up the menu. Also can this be done while the app is neither running on the background nor visually visible?
I want my users to be able to launch my app by long pressing back button, recent apps button or home button. Or even long press on volume up/down or power button.... something which would allow users to execute my app without touching a screen icon.
I offer similar voice solution to Google Now, which btw. opens after a long press on home button. Any way I can do the same? I get this question from my users almost daily...
I don't think your users will be able to do this without rooting. I found this thread which is worth reading:
http://forums.androidcentral.com/samsung-galaxy-s3/183113-button-remapping.html
alternatively they mentioned Go Launcher app
I've read through the list of ACTIONs that you can use for starting an activity through intents, but can not find any of the ones you wanted. If you do find any other ACTION useful there is more info on how to actually do it here.
I am an Apple iPhone user. I have never owned an Android of any type so I am used to the button I have to tap on the screen to go back a screen instead of the physical "back button" that Android has. An iPhone developer has to code the back button in for the user to operate the game but an Android developer does not necessarily have to code a back button and can just rely on the physical button on the phone.
My question is if it is okay for me not to code a button for my Android app and just let the user use the hardware back button on their phone? If there is no back button to tap, will an Android user instinctively know to hit the physical back button to jump back a screen? I don't really know this answer since I have never owned an Android and always rely on the iPhone coded in buttons.
The picture below is me coding in the back button instead of relying on the physical button on the phone. I am wanting to back out the back button from my code.
You shouldn't code a back button on your app. See the pure android guidelines here for more info on android apps look and feel.
Every Android Device contains Back Button. And Android users using the Back button since first version of android released. They All have idea on Back button , No need to implement it separately, User already Habituated it.
I have developed for both iOS and Android, and find the best answer to be using both. Android users know to use the hardware back button, but new users, or former iPhone users, often expect an on-screen button. There is no harm in having both, and an on-screen button may be a nice visual touch.
Cases where you may decide not to have a back button include layout for smaller screens - when screen real-estate is very precious. Just keep in mind that the most important part of an application is the user experience.
The key is to make your app as user friendly to all users - but don't take away the expected experience from dedicated Android users (for instance, if you are developing a single-activity app with multiple popup Views, the ideal performance of the back button will close the view, rather than closing the whole app).
Also if you want to have a button to go back at the top right of the activity, there is a way to add one on the action bar. Take a look at the Android Developers page if you want.
I'm new to Android Java programming.
I've created a simple chat app. Things are going well, but I've hit a small snag. I've set launchMode="singleTop" in my manifest's application tag, and overrided the back button, so now the chat app remains running (in the background) when the user presses the back or home button. I've also created some notifications that pop up in that status bar when a new chat appears (with intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP) set), and when the user clicks the notification it brings the already running chat app to the front. That's all working fine; the problem arises after I bring up the app from the status bar notification, then click back or home, then choose to open the app from the applications menu or a shortcut on the launcher, and thats when it opens up a second instance of the app.
Is that clear?
If the app isn't running and I choose to run it from app menu, it runs (doesn't display any chats because it hasn't received any). I receive a chat and see it on screen in the app, I press back button, I go back and open app through app menu, it runs and has the chat messages from before. Good. Now I press back (so app is in background, but still running), I receive a chat, it pops up a status bar notification, I click it, it opens up the app and shows chat messages from before. Good. Now I click back (so app is running in background). I then open the app through the app menu (like I did the first and second time), but this time it doesn't show the previous chat messages, and if I receive a chat, it makes 2 notification sounds, so I know it has started a new instance of the app.
Any idea what's wrong?
Thanks.
set the activity launchMode to singleInstance in manifest.