Is there any way, through which my android application can interact with a web page that I provide?
For example: I want to retrieve user information from a web based erp-system. So first user needs to log-in with his/her credentials. After that, the student home page opens up. I want to know, suppose that I have the credentials in simple text.
How can I insert, 'click' certain buttons elements of the web-page, in background, without any user intervention. Also, once the homepage loads up, Is there any way through which I can access data from DOM elements?
Simply, I just want to know, is this even possible? All the user interaction taking place in the background? And if yes, can someone just point me in a right direction? I actually don't know how to 'term' this process.
Thank You.
EDIT:
I found out, that the button has an associative function 'logincheck()'. So, by calling this function, same can be achieved, right? Problem is, how the credentials can be inserted in the labels and how this function can be called?
You can manually download the html page on interests and parse it using regex to find out info contained in DOM elements.
Or it s possible to automatize also the login by using for example Python and the request lib to issue HTTP requests and retrieve the pages.
Another option, more graphic oriented is to use JWebUnit lib (for Java) to navigate the pages and login etc
If you are the owner of the webpage or if you have access to it's code, look for division IDs for the form fields that you're trying to fill. Then, in your WebView, once the login page loads, you can fill the form using JavaScript -
Assuming that the username form field has an id 'username' and the password field has an id 'password',
webView.getSettings().setJavaScriptEnabled(true);
String js = "javascript:" +
"document.getElementById('username').value=" + "'" + username + "';" +
"document.getElementById('password').value=" + "'" + password + "';" +
"document.forms[0].submit();";
webView.loadUrl(js);
Related
I develop app in kinetise tool and I found it is possible to easly add list with Google spreadsheet content. But I don't know whether it is possible to edit sheets from user account (when it is public or user sign up with Google). Let's say add records for specific position (A1) in specific sheet (SheetName). How to achieve this?
Yes, you can both view your spreadsheet (read) and edit it (write) in Kinetise.
Firstly, publish your sheet and get public URL address (File -> Publish to web).
Now in Kinetise editor add List widget and select "From Google Sheets" in Online source view. Paste your URL address and data from sheet should be displayed.
What about write, well you need to Sign-In with Google first. So please add Google login method to your application. You can do this attaching Google login widget to your Splash Screen.
Then in screen where you want to edit sheet please add Form widget. Select "To RESTful API" as form send destination. Paste below url:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}:append?insertDataOption=INSERT_ROWS&valueInputOption=USER_ENTERED&access_token=##GetGoogleUserAccessToken##
where
{spreadsheetId} - yours spreadsheet ID (same as in List widget's URL);
{range} - columns range: A1:B1 (depends on number of columns in your table).
The last thing you have to do is to edit send request body. Please click Settings button on the right of URL address. In Body tab and Request body transform section please paste:
{ "values": [
[ .form.field1, .form.field2 ]
]
}
field1 and field2 are names of form fields, so if you have another names or more columns please change it. And that's all, now you should be able to edit spreadsheet.
I'm a real rookie with Android and especially 'Save to Android Pay' API. I'm following the Google's Guide and Google's Sample, in order to implement my own offer class and "Save to Android" button.
According to the tutorial, for every type of offer card I'm creating, I need one Offer Class, and for every user who will save the card to his Android Pay app, a new object will be generated. So Let's say my card has the following fields:
Headline
Logo
Card ID#
and in addition, every user has 2 unique fields:
User ID#
User ID2#
I know when and how to pass the first 3 fields of data but I'm not sure where and how to pass the last 2 fields. I'm implementing the "Save to Android" button on a website (exactly like the sample) and assume I have the two data fields save as JavaScript variables on my website. Can I send the 2 unique fields to "Save to Android Pay" API Servers from my website while (or before) the user clicks the "Save to Android Pay" button?
Got an answer from 'Save to Android Pay' team:
There is a section in the Loyalty.java class that creates an object with specified parameters. The Java quickstart has hard-coded values as an example, but can be easily changed to the variables you use to keep track of user's ID numbers, etc.
You can can insert your user's unique values in this section:
// Define Wallet Instance
LoyaltyObject object = new LoyaltyObject()
.setClassId(issuerId + "." + classId).setId(issuerId + "." + (Math.random()*1000))
.setState("active").setVersion(1L).setBarcode(barcode).setInfoModuleData(infoModuleData)
.setAccountName("Jane Doe").setTextModulesData(textModulesData)
.setMessages(messages).setLinksModuleData(linksModuleData)
.setAccountId("1234567890").setLoyaltyPoints(points);
Also note that in the WobGenerateJwtServlet.java class, it creates a JWT depending on the object type. Specifically for loyalty objects here:
// Create the appropriate Object/Classes
if (type.equals("loyalty")) {
LoyaltyObject obj = Loyalty.generateLoyaltyObject(credentials.getIssuerId(),
context.getInitParameter("LoyaltyClassId"), context.getInitParameter("LoyaltyObjectId"));
obj.setFactory(new GsonFactory());
payload.addObject(obj);
Hi. Using Accessibility, i am trying to auto fill username &
password of an any app from my app which is managing username &
password of all apps like dashlane. i found one way to auto fill
field value using Action_Paste. when user starts to focusing on
EditText it will get the AccessibilityNodeInfo by using getSource() method, using that it auto
fills EditText Filed, below is a code for above process.
Code:
AccessibilityNodeInfo source = event.getSource();
if (source != null) {
ClipboardManager clipboard = (ClipboardManager) MyAccessibilityService.this.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", "TEST DATA");
clipboard.setPrimaryClip(clip);
source.performAction(AccessibilityNodeInfo.ACTION_PASTE);
Toast.makeText(MyAccessibilityService.this, "Pasted Successfully", Toast.LENGTH_LONG).show(0;
}
Here i need to extend my ui like, it needs identify the login page, once its confirmed as a login page it will show the list of login item. based on user selection it will auto fill username field & password field.
Here i have two question
how to identify the login page of an app, i tried something like, when user clicks a First Edittext filed i will search for next node and check whether it is password filed or not? i used getchild() method. but does not give the child element. When login page loaded in app, i need identify whether it is login field or not? How can i identify a login page, please any tutorial welcome.
based on the source i am filling the field values. if i identified a login page then how to get AccessibilityNodeInfo of username & password. So that i can fill both fields rite?
i spent time for those problem.but i cant get any thing. please anyone can give deep explanation & tutorials for the above problems. thanks.
Use getRootInActiveWindow() to get the root node & iterate the tree to check all the nodes.
My answer here might help.
This way, you will find your Username & Password nodes.
Now, you can paste the text in these nodes.
But i will suggest to not use clipboard to fill passwords as there are some apps that continuously watch your clipboard.
Such apps can intercept your login credentials.
I have successfully added a word to Android's predefined user dictionary, but i want to create a custom dictionary which can only be accessed by my application.
For example: When i type "lol", the suggestions show me "laugh out loud" but when I want another meaning of "lol" then I can manually add another meaning of "lol" (eg, "xxxxxx" - so the next time the user writes "lol" in an EditText, the suggestions will show him "xxxxxx").
No other application should have access my dictionary data.
I have worked with spell checker class but it gives me only correct word and I can't my own word meanings.
Please give me some suggestions or links.
There is an Androids inbuilt class UserDictionary so that you can add your spells programmatically into that, Here is a link you can go through with , and which may relates to your problem .(In this solution nidhi has manged programmatically to retrieve data back)
Add word to user dictionary and retrieve them back from dictionary
In addition you can go through following links to :
http://developer.android.com/reference/android/provider/UserDictionary.html
http://developer.android.com/reference/android/provider/UserDictionary.Words.html
Moreover if you want a custom personal dictionary then manually you have to store words and retrieve them back .
Hope that helps !!!
I have a webview in which user has to type their email and password in the corresponding input fields. I want to show the email friendly keyboard when the user taps on the email field. How to do it using javascript ?
I tried using the javascript by using the following code
String emailKeyboard="document.getElementById('src').type=\"email\";";
mWebView.loadUrl("javascript:(function() { " + emailKeyboard +"})()");
also i tried by getting the element by name as
String emailKeyboard="document.getElementByName('j_username').type=\"email\";";
mWebView.loadUrl("javascript:(function() { " + emailKeyboard +"})()");
where j_username is the name of the input field. But it is not working. Any help greatly appreciated.
Thanks,
Senthil.M
Why not just set the type of the fields directly in the HTML rather than trying to add them on the fly (which causes more strain on performance anyway...).