I am trying to create a desktop shortcut from my app, in oder to have my app icon on the user's phone desktop once he/she launched it.
I followed the instructions here in order to create a shortcut with 'shortcutManager.requestPinShortcut()'. It works, I manage to display the Google popup that allows to create the shortcut.
Nevertheless, due to the ShortcutManager API limits, I need to reset the API counter so that I can display several popups during the dev/debug phase.
I use the reset method mentioned here, that is to say:
Developer Options > Reset ShortcutManager rate-limiting
adb shell cmd shortcut reset-throttling [ --user your-user-id ]
but:
Method 1) doesn't work (doesn't seem to reset the counter as I still don't see the popup after reset)
Method 2) also doesn't work when I use 'adb shell cmd shortcut reset-throttling' without mentioning the 'your-user-id'. Indeed, I don't know what is the user-id.
How can I find this user-id ? If it still doesn't work, how can I do to display a popup each time I want during development ?
Thanks for your help.
Related
I wish to test my android application without resetting its state. I noticed that different popups appear everytime I run the application so I wish to log all the various popups.
My definition of "run" here is tapping the back button on my phone and tapping my application icon again.
However, I am unable to simulate this physical tapping of the phone on my Appium test. I can exit my first test but I am unable to reopen my application again. (Simulation of tapping on the application icon with my finger)
Things I have tried:
1. Setting noReset to true in capabilities setting
2. Using uiautomator to find my application. However, uiautomator doesn't seem to be able to detect any icons in the app menu page. It just shows many layers of frame layouts.
3. closeApp() and launchApp() resets the application and this defeats the purpose of my test. My application somehow behaves differently with each run so I hope to run my test in a single session (i.e. closing and opening the application while it is still in the same state)
Is there anyway I can simulate the physical tapping of the icon in the form of code? I know we can set the coordinates but I don't want to hard code my test to run only on a specific instance of the phone. It will not run if other applications are uninstalled and my application icon shifts to another position.
This worked for me:
"appPackage": "com.company.app",
"appActivity": "com.company.app.activities.HomeActivity",
"skipDeviceInitialization": true,
"skipServerInstallation": true,
"noReset": true
This won't reinstall the .apk, appium server and it won't delete the appdata. You can just start the app like you've left it before starting the test.
I found this browsing the same issues on GitHub:
https://github.com/appium/appium/issues/4955
https://github.com/appium/appium/issues/3783
If I am not getting you wrong here, you can try using a combination of following using AndroidDriver :
driver.navigate().back(); // from app home screen to mobile home screen
driver.startActivity(String appPackage, String appActivity); // or possibly cast ((AndroidDriver)driver)
You can start the app by giving The package name and start activity name instead of apk file in desired caps , this way ur app won't be reset every time u launch app
Den use presskey4 for tapping in back button , den u can call launch app function to launch the app without reset
I use the Java Console to debug / QA my company's products but sometimes I accidentally hit the "Close" button and in order to see the window again, I have to restart the entire application.
Is there an easier way to reopen the Java Console without having to restart the application?
Edit: I test the Java application on Windows, Linux, and OSX
I don't know how you would get this done in Windows , but you should look into screen.
To start your application:
bash$ screen
bash$ ./program
then if you accidentally close the window, all you have to do is:
bash$ screen -r
To detach from a screen you are looking at you need this key combination:
ctrl-a + d
^ This means press ctrl and a at the same time, then release keys and press d
the program should come to the forground so you can interact with it. I don't know if Max OSX comes with screen, but if it doesn't it can easily be installed using brew install screen.
Anyone who has more information on how you could do this in Windows, feel free to expand this post or post another answer.
I try to make an application which must be full screen. But when i press CTRL+ALT+DEL task manager comes up. Even i disable task manager, at this time its error message comes up and make taskbar visible. Then user get the chance to go to the dekstop but i dont want user to get this chance. Only user could be able to go to desktop when it did what application wants from it. So i need taskbar keep bottom of other windows until user does what it should do. And i need to do this by my application which i try to code in Java
How can i change the status of task bar using registry?
Why not permanently disable the taskbar?
Follow this link to permanently disable the task bar.
You can edit .reg files in Java, follow This link to know how to edit .reg files
"But how can i do it by java without reseting the machine?"
As far as i came across, you have to reboot your system, no way out.
Ok i found it.
When i changed the value of 8th byte value of Settings variable to 10 in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2
in registery
It just deselect the "Keep the task bar on top other windows" option
For applying the changes explorer.exe should be killed and re run
There are key strokes which Windows catches before they are sent to application and Ctrl+Alt+Del is one of those.
Regarding "Then user get the chance to go to the dekstop", if you set frame.setAlwaysOnTop(true);, user won't be able to switch to other any application.
You can use java's fullscreen API, and then use a Robot to force focus back to your application. See here: Java Full Screen Program (Swing) -Tab/ALT F4.
Good luck in whatever you are doing - it doesn't sound fun!
I have a java Robot program ,where it can type a word on notepad,word etc,.
But the problem is i am not getting focus of window application, when i tried to enter the cursor in its textbox manually by using ALT-TAB,
And the application is not available in the list ,while doing ALT-TAB ,
also it is not visible in Task Manager-> Application tab
but, it is available with Processes tab of Task Manager.
Is there any solution to get focus of that windows application for keyPress using Java Robot.
Also ,in some other PC's ,i am getting Clear Focus of the application when i put the cursor manually after running the java robot program. I have installed JDK1.6 in all my PC's. It is not working only in my PC's.
Thanks in advance!!
I think that your best bet is to use JNA to allow you to make system calls.
Assuming a Windows program, you could use JNA to make calls to the user32.dll including dll functions such as FindWindowEx(...) and SetForegroundWindow(...) to set the window of your choice to the foreground.
Instead of getting the focus of the other app, you could put your robot to the background, returning whatever was in the foreground previously (ie your target app) to get the focus.
OK, maybe I'm dumb/blind, but in the docs it says "rebuild and restart the server." But I don't see a button to do this anywhere. Or from any contextual menu. And I can't find anything in their docs explaining how to do it. If I just try to start the app again, it gets angry because I already have App Engine running on the needed port.
Only solution I've found is to restart Eclipse... any other ideas? A screenshot of a button would help if possible. :)
In eclipse, there is a view that contains your Console. If you click on that, you will see the STDOUT and STDERR output of your running application. In the upper right, there should be a red box that will terminate the currently running program.
I have a different and possibly more productive solution for you. Like with most web development environments you probably want to change your source code and have Google Appengine server reload the new code for you.
You need some version of the traditional "touch" unix command (if you work on windows you can download a version from here).
Then go to you project properties, Builders and add a new build step as a "Program". Under "Location" enter the path to your "touch" command ("D:\bin\UnxUtils\usr\local\wbin\touch.exe" for example - on Posix systems just "touch" should be enough since it's already in your PATH) and in "Arguments" put something like "${project_loc}/war/WEB-INF/appengine-web.xml".
Also go to the "Build Options" tab and check "During auto builds".
"touch" will update the timestamp in you appengine-web.xml. When the App Engine server detects changes to you appengine-web.xml it will reload the app automatically. The load process is very fast so it can be done whenever you change any file in your project (which normally triggers the auto-build in Eclipse) - you can tweak the builder to only run when you change certain types of files.
I might add that the "little red box" is not always visible. It drove me crazy reading that same instruction but not seeing the terminate button until I discovered that the Console windows has "layers" that you can select from using the drop-down button on the far right of the controls for the Console view. You just need to go "back" to the console screen that says the server is running and you will see the little red terminate button.
The previous answer wasn't cutting the cheese for me. Upon first starting App Engine, the red square would be available above the text entry area. If I then clicked the run button again, then red square would go away and the console for the previous launch would be replaced by the console for the new launch. To manually stop the App Engine server, you can kill it from the terminal:
http://geekbrigade.wordpress.com/2009/02/26/how-to-find-and-kill-a-process-that-is-using-a-particular-port-in-ubuntu/
In short, "sudo netstat -lpn |grep :8888" and kill the service by process ID.
Strangely, adding Google Web Toolkit to the project made my App Engine launch show up in the Development Mode pane, where it could be easily be killed or restarted.
Just Click on Debug perspective (should be on upper right panel), select the instance of web application on Debug panel (if you don't show it, you could enable by menu Window->show view->Debug) and click on red box of view menu.
The best I've found is to setup the keyboard shortcuts for the console's terminate button, and the run/debug start/restart command. By default, you can enable Command-F2 to terminate, and Command-F11 to restart, its fairly painless. Make sure to enable the full debug menu group (click on main toolbar -> customize, etc)
If you include the gwt SDK in your project, the gwt development mode box contains a reload server button that will work just fine.