How to use driver.startActivity on IOS? - java

Hi I was building some tests for Android and now I want to run the same tests on IOS. Sometimes in my code I have to open google chrome then go back and launch the app, for that I use
driver.startActivity("com.consul.android.smartbeer.staging", "com.whirlpool.ted.View.SplashActivity");
and
driver.startActivity("com.android.chrome", "com.google.android.apps.chrome.Main");
My question is:
how can I use a similar command for IOS? I know that it has driver.launchApp(); but If I insert the Bundle_Name it doesn’t work. Is there another way?

To get quiet the same functionality for iOS with Appium you might look into using deep links:
driver.get('deep_link_url')
It allows navigating directly to appropriate screen of your iOS app.
However:
deep links should be implemented in your iOS application
it works only for Simulators at the moment.
You can track progress on getting it work with real devices here

Related

How to automate the android phone back button using appium on emulator

I have recently started working on test automation for a native mobile application on Android using Appium(java client library). I haven't been able to figure out any means to automate or create a gesture for using the Phone back button to go back to the previous page of the app. Is there any driver function that can be used? I tried following code,
driver.sendKeyEvent(AndroidKeyCode.BACK);
by checking other posts, but it did not work for me. Can anyone suggest a solution?
you need to use following code for go back.
driver.pressKeyCode(AndroidKeyCode.BACK);

Injecting items in Android browsers caches

I am currently trying to find a way to programatically inject items into a mobile browser's cach on Android devices. The browser type doesn't matter, it can be Firefox, Chrome, Android's built in browser, etc.. Is there any documentation or examples of ways to programatically inject objects into the browsers of Android devices?
Not really an answer, just a heads up. Seeing that your question is tagged java, I assume you want to do this from an application, and not from the browser. I'm pretty sure that's impossible, because each Android app is running in it's sandbox. Communication between apps is done through Intents and IPC. In both cases, you are limited by what the target app is offering support for.
You can use proxy, to get this structure :
Client => Your APK => Server
(Like this application).
With your APK you can choose file to send.
Like already mentioned by Corneliu, its impossible for an normal android app to write into the data section of another app.
Although it should work when the phone is rooted. Apps like TitaniumBackup which require root can read and write the data saved by other apps. You can use TianiumBackup to make a backup of the browsers and look in the *.tar.gz file for the internal data structures and the SQLite DB files...

How to run Java code on Android device without uploading apk

Is there an easy way to run Java code on an Android device without actually delivering an apk? I'd like to test out function calls without building an entire project.
For instance, it would be cool to run calls like Camera.open(1) and see what the device responds with. It takes forever to rebuild an entire project and redeploy it for minor changes. The only option I can come up with is having some sort of text field that takes user input, executes commands (Compiler API?) and displays the result. Is there a better way?
There is the Android Scripting Layer
https://code.google.com/p/android-scripting/
There is Dev Apps Direct for looking and loading sample open source libraries.
There is API Demos which is just the official samples from the android sdk that a third party published on Google Play

How to run Java app in Android

Is it possible to run java app (jar) in my android application? Because I need to create PDF, the problem is if I generate PDF in android, only can show with small image, if it contains large image in many pages, it will be error. So I think, I can generate PDF in java and then included to android app.
Concernig the mentiones app JBED:
Well honestly, I could not find any credible source for this tools JBED, so I would really be very cautious (e.g. who is the developer?)
In the manifestfile (in Androidmanifest.xml, where every app has to state what rights it needs to run, see How to view AndroidManifest.xml from APK file?) there are many rights mentioned (what could be necessary, as the app wants to run as an emulator), so a java application might want to send an SMS, record audio, take pictures and place calls -- so the emulator would need those rights as well.
But then the app also registers the "android.intent.action.BOOT_COMPLETED" event (i.e. autostart after boot) and this would go against every description of the tool.
Ah yeah and giveaway: The apk has a folder "certs" that has some (root-)certificates. But those are not the real certificates of the authorities, e.g. Versign. If one installs the app and by that those certificates the trust you might have in https-connections is lost because those who made the fake certificates can create own, false certificates that your phone would trust.
I assume (or am pretty sure) this is a spy tool, but I could be wrong. The (rare) testimonials that claim the tool ran perfectly will probably be the same person that posted the tool under a different name.
Andreas
You can import java Third-party libraries into Android app, follow the steps here.
I am not sure whether it will work,but just try.
If your program is a console program, the answer is yes.
Install Jvdroid from Google play. Click terminal and then write this command: java -jar YourJarFileName.jar
The simplest way would be to some install terminal emulator and then install java and then you can run java apps on standard java. You can even install full Linux distro with x server without rooting the phone, then connect to it from x client and you have Linux desktop on android. Once I've even installed eclipse for java development on it and everything worked. I tested this setup last time in 2014, but I'm pretty sure you can do this nowadays as well. The app with Linux I get from play store as well app for the x client. The app I used back then was "Debian no ROOT" or smthg like this. You need to check what's currently available to make this setup in Google Play store according to your android version and your preferences. Last time I've checked there was a lot of different tools for this kind of task. Lastly I've even successfully installed TF and keras on my android phone using terminal emulator.
You can use JBED. JBED is an .apk Android application which run java games and app on your android Device. JBED is a java android emulator, by using
this application we can install .JAR/.JAD/Java/J2ME/MIDP app on android phones.
You can do it quite easily as there are many ways to run java apps on android. Specific application called Java Emulators can do it quite easily.
These are four most popular java emulators for android viz, JBED, PhoneME, Jblend and NetMite. These are arranged in order of their preference. You can use phoneme for non rooted device, however if your device is rooted try any of the remaining three applications.

"One App" Android System

I created an Android app which communicates via USART with a µC in order to evaluate data. My co-workers and customers should use the tablet for only this purpose now. Is there any possibility to "hide" the Android OS or making it inaccessible?
Devices are rooted and I am willing to build custom ROMs (even though I do not have any experience with that yet). Are there any approaches available that I do not have to start from scratch?
Many thanks for your help.
Well. That what I'm trying to do !
The first thing I tried was to start the app just after the boot of the device (Quite easy with this).
Then, I get Android source code, and I hide the bottom bar using this code
The problem is, if your application is not stable ... you'll have some problem.
If you want to modify Android source code, the developper doc contains a very good tutorial to start !

Categories

Resources