private void click() {
Log.d(TAG, String.format("Click [%d, %d]", cursorLayout.x, cursorLayout.y));
- AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
if (nodeInfo == null) return;
AccessibilityNodeInfo nearestNodeToMouse = findSmallestNodeAtPoint(nodeInfo, cursorLayout.x, cursorLayout.y + 50);
if (nearestNodeToMouse != null) {
logNodeHierachy(nearestNodeToMouse, 0);
nearestNodeToMouse.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
nodeInfo.recycle();
}
I am using AccessibilityNodeInfo nodeInfo = getRootInActiveWindow(); i am getting null value here
I try
view.createAccessibilityNodeInfo();
By these method i got node. but I got one error seald unreachable like that.
view.getRootView().createAccessibilityNodeInfo();
xml file for accesibility
ManifestFile
From the comments I can't seem to get you to show the contents of your service config... I don't want to confuse you with mine, but I feel this example may be more productive.
In your manifest, you'll need to have an accessibility_service_config file referenced. The name is not important.
<service
android:name="..."
android:enabled="true"
android:label="..."
android:description="..."
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="#xml/accessibility_service_config" />
</service>
Then res/xml/accessibility_service_config.xml needs to be something along the lines of
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityFeedbackType="feedbackSpoken"
android:accessibilityFlags="flagDefault|flagReportViewIds"
android:accessibilityEventTypes="typeAllMask"
android:canPerformGestures="false"
android:canRetrieveWindowContent="true"
android:description="..."
/>
It could be that you just need to set canRetrieveWindowContent to true. Documentation:
Attribute whether the accessibility service wants to be able to retrieve the active window content. This setting cannot be changed at runtime.
Required to allow setting the #AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS flag.
May be a boolean value, such as "true" or "false".
Or it could be the contents of needs at least android:accessibilityFlags="flagReportViewIds"
According to the documentation:
This flag requests that the AccessibilityNodeInfos obtained by an AccessibilityService contain the id of the source view. The source view id will be a fully qualified resource name of the form "package:id/name", for example "foo.bar:id/my_list", and it is useful for UI test automation. This flag is not set by default.
I strongly recommend you configure your service properly - I don't recommend copying and pasting my service config verbatim.
Your service config XML is malformed:
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"> <-- the angle bracket shouldn't be here -->
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFlags="flagDefault|flagReportViewIds"
android:canPerformGestures="true"
android:canRetrieveWindowContent="true"
android:accessibilityFeedbackType="feedbackAllMask"
android:notificationTimeout="200"
android:packageNames="com.example.accesibility"
android:canRequestEnhancedWebAccessibility="true"
</accessibility-service>
change it to:
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFlags="flagDefault|flagReportViewIds"
android:canPerformGestures="true"
android:canRetrieveWindowContent="true"
android:accessibilityFeedbackType="feedbackAllMask"
android:notificationTimeout="200"
android:packageNames="com.example.accesibility"
android:canRequestEnhancedWebAccessibility="true"> <-- the angle bracket should be here -->
</accessibility-service>
Related
I'm doing a Hello World in Xamarin Android, but when I try to change the launcher icon, it throws the following error: "No resource found that matches the given name (at 'icon' with value '#drawable/icon')."
Actually I don't have any "icon" in my resources, the icons' names are ic_launcher:
And my manifest looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="HelloWorldXamarinAndroid.HelloWorldXamarinAndroid" android:versionCode="1" android:versionName="1.0" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<application android:label="Hi android" android:icon="#drawable/ic_launcher"></application>
</manifest>
I've already cleaned the project and tried to rebuild it, can someone help me?
If I change all the images' names to "Icon.png" and the manifest with "#drawable/Icon", it works, my question is, why Xamarin doesn't work with other names
I found the problem, in Main Activity is set the icon too, so it's necessary to set the new name there too:
[Activity(Label = "HelloWorldXamarinAndroid", MainLauncher = true, Icon = "#drawable/ic_launcher")]
public class MainActivity : Activity
{
...
}
Right click the Droid project and select Android Manifest from the menu list. Under Application Icon you will see which icon the application is referencing.
Below is a picture of where the icon is being references.
i'm adding the Facebook module to my app in order to use the login Facebook button using appcelerator/titanium and alloy framework.
here is my code:
var fb = require('facebook');
fb.addEventListener('login',function(e){
if(e.success){
alert("connected");
}else{
alert("failure");
}
});
fb.addEventListener('logout',function(e){
if(e.success) {
alert("successfully logged out");
}else{
alert("failure");
}
});
var mybtn = fb.createLoginButton({
'top':'160',
'height':'35',
'width':'80%'
});
$.login_form.add(mybtn);
It seems that this part of this code causes the problem:
var mybtn = fb.createLoginButton({
'top':'160',
'height':'35',
'width':'80%'
});
$.login_form.add(mybtn);
The error is the following :
exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.copark.mobile/org.appcelerator.titanium.TiActivity}: Unexpected CallbackManager, please use the provided Factory.; Titanium 5.5.1,2016/09/27 05:39,b18727f
I don't really understand that error, and neither how to fix it.
If anyone of you has the answer... :)
Thanks in advance,
Quentin
Add this code after require:
fb.initialize();
if(Ti.Platform.name == 'android'){
$.login_form.fbProxy = fb.createActivityWorker({lifecycleContainer: $.login_form});
}
On the android platform, in tiapp.xml or AndroidManifest.xml you must declare the following inside the node
<activity android:name="com.facebook.FacebookActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar" android:label="YourAppName" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" />
You must also reference the string containing your Facebook app ID, inside the node as well:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/app_id"/>
The app id goes into the the file /platform/android/res/values/strings.xml (or your custom theme), where you should define
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- ... -->
<string name="app_id">1234567890123456</string>
<!-- ... -->
</resources>
</xml>
where the number is of course the app ID. The app ID is not set programmatically.
Well.. I have a big problem my app id is "org.qtproject.example.test". I want to change to "com.mycompany.myapp". I was looking at the whole project and there is no way to change it. How do you do that?
change the package name in the Android manifest file.
manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mycompany.myapp" android:versionCode="1" android:versionName="1.0.0"
Open the AndroidManifest.xml file of your project in Creator and it's the first setting in the manifest editor form.
Also, from QGuiApplication see the setOrganizationName(), setOrganizationDomain() and setApplicationName() functions.
According to the android Documentation
android:userVisible defaults to true and controls whether or not this sync adapter shows up in the Sync Settings screen.
but it shows in the Settings whatever value it gets!
EDIT Nov 03 2014
I removed android:icon android:label android:smallIcon from authenticator.xml and now it's not showing in the Accounts but there is an empty entry on Add Account tested on Samsung Galaxy S4. And for the record this totally crashed my 2.3.3 emulator when opening Accounts from Settings.
I have implemented my own syncadapter it's working for me as below :
Case 1: When android:userVisible="false" There is only app icon,Account name and app title
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.example.kukssyncadapter"
android:accountType="com.example.kukssyncadapter"
android:supportsUploading="false"
android:allowParallelSyncs="false"
android:userVisible="false"
/>
Case 2: When android:userVisible="true" There is app icon,Account name and app title with sync control functionality as you can see from image
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.example.kukssyncadapter"
android:accountType="com.example.kukssyncadapter"
android:supportsUploading="false"
android:allowParallelSyncs="false"
android:userVisible="true"
/>
I implemented the following code and want to access the key meta-data value as a Long integer from the MetaActivity.java class.
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.slk.metachecking"
android:versionCode="1"
android:versionName="1.0" >
<application>
<meta-data android:name="key" android:value="488659867867350" />
</application>
MetaActivity.java
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(),
PackageManager.GET_META_DATA);
Bundle metaData = ai.metaData;
metaData.getString("key"); // Returns -36235050
metaData.getLong("key"); // Returns 0
Does Android support long as a type in meta-data tag?
refer to http://developer.android.com/guide/topics/manifest/meta-data-element.html, as you can see only getInt is supported, so if you want to specify long value set it as a string (for example L123456789123456789) and parse it as a substring(1)