I've created a custom SyncAdapter and given it the following XML:
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.android.contacts"
android:supportsUploading="true"
android:userVisible="true"
android:accountType="#string/authenticator_account_type"/>
Thousands of searches has led me to 'supportsUploading="true"' but this is definitely not the case - contacts are still being marked as read-only.
Since most of the documentation has a very "self-explanatory" vibe to it (Which is definitely not the case), I have no idea where to begin. Could someone please give me direction on this?
Edit: I even verified that the Account was in line with what Google has set for their accounts:
The problem turned out to be that the contacts information has to be set up in a very particular way. It includes having an XML file with a ContactsAccountType definition, a sync adapter XML file (sync-adapter) with android:supportsUploading="true" set... And there appears to be no one particular solution to this - if anything is not set up fully, the OS will treat ALL contacts as read-only.
I was able to copy the default contact from AOSP and modify it, removing things very slowly, one at a time (As like I mentioned, one wrong removal means read only) until I got it down to what was necessary.
The downside is, because both the OS as well as any function related will return that the contact is editable, it does not mean that the OS will allow it.
Related
First of all, not sure where to post this on the Stack community.
I am creating an app, which suppose to be responsive, see: pedecabra.ideacodinglab.com
When I save to Firebase, from different devices, it creates the same collection twice, it supposes not to happen. But...just warned the user to use the same device. But now, when I try to erase from the computer, I cannot erase from a computer what was created on my device: Android 11, Galaxy A3.
This an example, there are two Jorge Guerra Pires, which supposes not to happen, two collections with same name. When I try to erase, it does not recognize the name. I have done copy&paste from the other collection, where it recognized.
My theory: Firebase saves name based on local information, from the device. For us humans, it is transformed into strings, but the compute compares strings based on local operation system
I have done a research on Google, using searching sentences such as "same strings on different operation systems are different".
Discussion
"they are no longer existing just ont the device(s). " it saved locally the name, and also on the database. You can access from the same device, even after closing the app. But just the app can access the collection it created.
" It sounds like there is a difference between the names, like for example some whitespace or non-printable characters. "
tried manually, enter the caracter. Even the automatic access, from the app, just get what it created, even though they exist
See the several duplicates, which should not exist. I wanted the same nickname be accessable from several devices.
Same problem, typed manually, and tried copy&paste
The problem was that somewhere, no idea where, a small space was introduced in the end: it was just introduced in one device, I have already fixed, no idea which one.
So:
Collection #1: Jorge Guerra Pires/
Collection #2: Jorge Guerra Pires /
They were different. I have to give a small space to erase.
On the code:
this.store.collection(this.username.replace(/\s+/g, '')).add({ "timestamp": this.timestamp, "sentimentos": aux });
I have added in the end of username, before without: replace(/\s+/g, '')
Thus, I just had to make sure wherever the space was coming from, it would be eliminated before creating or accessing the Firebase collection.
Tried several space, to make sure 🤣😂😁
Now I can access the same collection from different devices!
I have been scouring the internet for a simple easy to implement Android file chooser dialog that also has the option of selecting multiple files and returning a uri or string array with all the files selected.
Currently I use aFileChooser on github and it is according to me better than android-file-dialog. But neither address the issue of passing multiple files.
I am only an intermediate android developer but I think this would be something not so hard to implement by a pro.
I have looked at the code of aFileChooser and I think adding a check box to the file item would be the way to go but as far as code is concerned i am clueless and the developer seems he's not really gonna work on it in the foreseeable future
So in short im requesting for help to either add the select multiple files option to aFileChooser via the github or here, or maybe suggest to me a better dialog that does what i want.
I don't know any file chooser you could use, but I can show you how I made my own long time ago. It's actually pretty ugly, but it does what you ask for. You can select multiple files and an ArrayList<File> is returned via Intent.
So you could use it as an example of how to do it, and implement it yourself, if you really need it to (I wouldn't recommend you to use mine as it is now).
Here are the links to GitHub:
FileSelectionActivity.
Used layout file for the FileSelectionActivity.
MainActivity, on line 225 the FileSelectionActivity is started.
Below there's a screenshot of FileSelectionActivity, as I said, ugly.
"Go Up" goes to a higher level of the file hierarchy, there are two ListViews, one for directories and one for files. The files have checkboxes. When the share button is pressed, each item in the second ListView is checked to see if the checkbox is active or not. That's line 71 of the FileSelectionActivity file.
Anyways, I hope this helps you make your own file selector, or something.
Thank's to the answer above, I've made a simple library that addresses the concern. It not only passes an array of file paths but you can also use to select a folder.
It has thumbnails for image files
auto scrolls to last scroll position
will soon have language support for several locales
Here it is: https://github.com/tapaulo/Android-Multiple-file-Selector-Dialog
I have released an android app downloadable in the UK, but I wish to release a (very slightly different) version of the app for the U.S. Currently I believe I need to do the following for the new version of the app ...
1. Change the 'package' attribute in the manifest file to something different.
2. Ensure that on Google Play only the US can download the app.
Is there anything else I am yet to discover I need to do, or any other problems I am yet to consider?
Edit 19th July 13:19 GMT - I am currently warming towards using TelephonyManager.getNetworkCountryIso() as an initial country guess, and falling back on the locale if this fails (because of no SIM card). What do people think? Using GPS is also an option though, but is that overkill?
Since you say you're just changing a couple of strings (we'll think of the URL as just a string, too), I would suggest the following:
Create the resource directories res/values and res/values-en-rUS.
In each of these, create a strings.xml resource file
Define your default (UK specific) string values in the res/values directory, and your US specific string values in the res/values-en-rUS folder.
Then, to refer to these strings, simply use #string/my_string_name when referring to them from an XML document, or getResources().getString(R.string.my_string_name) when referring to them from code.
For more details on the types of resource qualifiers, check out this page, also for the list of qualified country codes you can use, see this page.
I'm sure anyone determined enough could change their region to US -- I'm honestly not sure offhand how the region is determined -- but for all intents and purposes this should do the trick without having to maintain two separate applications. I would just evaluate how critical it is that UK users be unable to access the US specific functions of the application, and with that in mind determine whether it is worth the maintenance of two applications.
EDIT Some more additional searching leads me to believe the region is locked into the build.prop file, which is not editable outside of rooting your device (i.e. it is not going to happen accidentally). That said, if it's still imperative that they have the correct option, I might suggest a popup dialog only on the first run of the application that confirms the locale with the user, saves it as a SharedPreference, and then choose your Strings programmatically based on that preference. That way you're still only maintaining one application, but you still have the flexibility of handling the two regions.
This is correct. The Play Store goes off of two things for who can download and if they can update. The first is the packagename com.andya.myukapp -> com.andya.myusapp should work, as long as none of your existing customers are expecting to switch freely between the two (assuming it's a paid app)
I eventually decided that the best policy was to use TelephonyManager to check the country of the Network.
TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String networkCountryCode = tm.getNetworkCountryIso();
If that failed, I got the locale.
String locale = context.getResources().getConfiguration().locale.getCountry();
This would happen once at the start of the app. The results of this would then be saved and be configurable in the settings screen.
I have a file on the Android SD card and would like to monitor any changes that happen to it through any external applications via code. Is there a way of doing that? Something like
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
http://developer.android.com/reference/android/os/FileObserver.html
has you tried FileObserver?
I don't think the system provides any sort of a callback type interface.
If you want that information I think you'd have to be check the contents of the file every so often and compare it to what you found last time. If it isn't equal then you know the file was touched by something else.
Surely this will end up being somewhat inefficient in terms of battery though I would imagine. If you must go this route I suggest as long of a duration in between checks as possible.
EDIT: I stand corrected. FileObserver looks like it'd be what you want. I've never run accross that one before. Props to #Grey.
I have queried the call log on Android. Some calls have 0 and other have 1 for the CallLog.Calls.CACHED_NUMBER_TYPE field. What do these numbers mean? Does 1 mean "Home"? Where is this documented?
AFAIK, it is not explicitely documented. But if you read the source code of android you'll see that what is used are integers defined in
http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Phone.html
(See allowed DATA2).
About how to retreive that in the relevant android source : for example in the tests =>
https://github.com/android/platform_packages_providers_contactsprovider/blob/c085b3eeebf13ebdfb197444747354a1d6eced2b/tests/src/com/android/providers/contacts/CallLogProviderTest.java#L81
If you want to do more things with call logs and callers infos that I've extracted a standalone version of Android's CallerInfo class :
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/src/com/csipsimple/models/CallerInfo.java
It allows me to cache by my own display name (which is not necessarily done by all android contact apps of all manufacturers -- HTC sense).
Also, keep in mind that all these Cached values may be erased by the contact app when it will refresh the screen. If you want to make sure your value remain the only way I found for now is to create an associated contact.
See https://github.com/Wysie/android_packages_apps_Contacts/blob/c3772f17c37817ebb4eb925146c3a633aa258aa2/src/com/android/contacts/RecentCallsListActivity.java#L364
(The source code of the call log app, that automatically refresh cached values).
Warning this code may differ on custom distrib from manufacturers. From example, as I said, HTC do that differently in their HTC Sense. And even inside android AOSP versions it changes. And no doubt samsung do things their own way in their UI for example.