appium java-client 8.x - getOrientation method was deprecated- how to check current orientation now? - appium-ios

Previously it was possible to check device orientation
driver.getOrientation()
In appium java-client 8.3 this method is no longer available. How to check current device orientation now?

Found it - Mobile specific extensions have been respectively moved to IOSDriver and AndroidDriver.

You will need to cast the driver. From Java Client 8.x.x and Appium 2.0, mobile specific extension commands have been moved to respective drivers.
Basically, if you have initialised the driver like below,
AppiumDriver driver = new AndroidDriver() or
AppiumDriver driver = new IOSDriver(),
Then, cast the driver like below,
((AndroidDriver) driver).getOrientation(); OR
((IOSDriver) driver).getOrientation();
This way, you access the mobile specific extension commands.

Related

Cannot get token from Huawei HMS push kit

error message as below
[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"907122036: no
right","code":"907122045","line":2568,"column":45,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.huaweipush.letsapp&modulesOnly=false&runModule=true"}
[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"907122036: no right","code":"907122045","line":2568,"column":45,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.huaweipush.letsapp&modulesOnly=false&runModule=true"}
The error code indicates that the Push Kit are not enabled. As a result, have no permission to obtain the token. How to enable the Push Kit, pls refer to the this docs.
Sign in to AppGallery Connect and click My projects.
Find and click the desired project in the project list, and click the app for which you need to set Push Kit parameters.
Go to Project settings > Manage APIs and enable Push Kit.
Go to Grow > Push Kit and click Enable now. In the dialog box that is displayed, click OK.
Enable the precise messaging function.
Here below is some checkpoints for the above issue.
First ensure you have enabled the push kit in AppGallery Console
Please check whether you are providing correct app id or not:
String appId = AGConnectServicesConfig.fromContext(MainActivity.this).getString("client/app_id");
pushtoken = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, "HCM");
It is recommended that the getToken method be called in the onCreate method of the first Activity class after app startup. Implement the corresponding listeners for getToken API and observe the logs.
Device: Non-Huawei phones must have HMS Core (APK) installed (which can be downloaded from HUAWEI AppGallery). There is no restriction on Huawei phones.
Network: The phone is connected to the network and the connection is stable.
EMUI version: EMUI 4.0 and EMUI 4.1 (for some devices), and EMUI 5.0 or later It is recommended that you use a device running EMUI 5.0 or later.

iOS 12 and above, fetch Wifi SSID to which iPhone is connected

I have gone through the link which explains getting SSID without private library. This works for devices below iOS 12.0.1. From iOS 12.0.1 onwards, the same library is not beneficial anymore. My code snippet is:
CFArrayRef myArray = CNCopySupportedInterfaces();
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
NSString *networkName = CFDictionaryGetValue(myDict, kCNNetworkInfoKeySSID);
These lines crash in Xcode 10 and above. myDict is returned nil. Is the library changed? Any other way to achieve this task?
Additional settings are reqiured in iOS12 for getting Wifi SSID.
Summary is that Apple qoutes:
To use this function in iOS 12 and later, enable the Access WiFi Information capability for your app in Xcode. When you enable this capability, Xcode automatically adds the Access WiFi Information entitlement to your entitlements file and App ID.
Thus, Enable Access WiFi Information for the Bundle ID in developer account. Reenable the associated provisional profiles.
In Xcode, under Targets -> Capabilities -> Access WiFi Information -> Enable it to ON.

Twain disable UI in DAT_USERINTERFACE, still show UI during scan

I'm trying to programmatically control a twain scanner within my custom application. I don't want to show the scanner's native UI.
I set CAP_INDICATORS capability to FALSE, and set CAP_UICONTROLLABLE capability to TRUE.
Then I start the scan using DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS, while ShowUI in TW_USERINTERFACE structure is set to FALSE.
I tested through different scanners. While my Epson DS-30 scanner is working as expected without ui, my Avision A6 scanner still shows a progress UI during scan:
This UI appears when I call DG_IMAGE / DAT_IMAGEINFO / MSG_GET operation, to get the image details from scanner. With DAT_IMAGEINFO command, this A6 scanner start to scan the paper, and after scanning complete, I could finally recieve the TW_IMAGEINFO structure.
I don't receive any TWRC_CHECKSTATUS while setting the UI mode.
So does this particular scanner actually doesn't support twain without UI?
Or could I have something workaround to disable this UI?
Actually a lot depends on the driver implementation.
So what happens is the options you set from the application configures the driver based on the capabilities it supports. If the driver capability for UI-less scanning is not allowed to be configurable by the driver in that case your application implementation may not work as expected.
Please refer to the TWAIN documentation for complete details.

Where to Get Encryption Key for Realm App in Swift

I have a Swift app that uses the Realm Object Server running remotely on a Linux server. Everything is working, including real-time sync.
Occasionally I want to inspect the contents of a local Realm file used by the iOS Simulator so I can do some debugging. When I browse here:
~/.../CoreSimulator/.../Documents/realm-object-server/<unique id>/
...and I try to open this file: realm%3A%2F%2F104%2E236%2E129%2E235%3A9080%2F%7E%2Fmyapp.realm
I get prompted with: Please enter a valid encryption key for this Realm file.
Where do I get this encryption key? I tried using the admin token from the server, but that doesn't appear to be working.
Also, can I turn off encryption everywhere? Or is it mandatory for any app using the Realm Object Server?
It is not possible to open the local version of a synced Realm file using the Browser (or anything else, for that matter). This is due to differing history types internally (but I won't go into that now). In order to inspect the contents of the Realm file, you have to open it using the previously defined syncURL. The browser will then download the file and show you the contents.
A few links on this topic:
https://github.com/realm/RealmTasks/issues/327
https://github.com/realm/realm-core/issues/2276
You may use old version of Realm Browser, please update it and check the result again.
Use Realm Studio instead which worked for me.
Here can download the file
byte[] key = new byte[64];
new SecureRandom().nextBytes(key);
String encryptionKey = byteArrayToHexString(key);
//encryptionKey is what you want byteArrayToHexString see
Log.d("test", "encryptionKey:"+encryptionKey);
byteArrayToHexString() method you can see:How to convert a byte array to a hex string in Java?

Phone Data Access in android, iphone using Flex Builder

Is it possible to access phone data like (Contact,Message) in android,Iphone using Flash Builder Mobile Development app .... If It's Possible using Adobe air so tell me ..
thanks
If the underlying operating system exposes that data, you can access it using a Native Extension. You may have to write your own Native Extension to do that, though.
You can call these API's -
Accelerometer
GPS
Camera
Microphone
To store data-
Sql Lite Datebases
OS Interactions-
Text Message
Email
Call
Example-
protected function sendMessage(event:MouseEvent):void {
var message:String = "";
message +="sms:";
message+ = sendTo.text;
navigateToURL ( new URLRequest (message));
}
This should open your messaging app. However the data you to want to read is mostly going to be protected. You can write a Native Extension though and plug Flex into it.

Resources