This question already has answers here:
What is a UUID?
(8 answers)
Closed last month.
ua:fa95ebdb-6da9-498c-aabb-77c7baaa28d3
When I woke up this morning, this "code" was the last text copied to my phone (Samsung, Android version 12), of course it was not me who copied this string, and I spent the night alone. I saw this when opening the GBoard keyboard, which offered to paste it. I didn't enable clipboard with this keyboard, so it was less than an hour before I woke up.
At first I thought it was me accidentally writing this text while sleeping (my phone is next to me all night, not turned off). But looking closer, I saw that it is a hex code. While searching on the net, I saw that ua can mean "user agent" but impossible to find what this hexadecimal string means...
Does anyone know this kind of string? Or would have any idea what could have happened to cause this to end up being copied to my phone? I admit it scares me...
The format of this string is called "UUID" (universally unique identifier), or "GUID" (globally ...) in some places.
It represents a series of 128 bits which are usually chosen at random when a unique ID for anything is needed.
The collision probability on 128 random bits is so low that they are considered unique (or more precisely: unique enough) even without a central coordinating instance that guarantees global uniqueness.
That being said - if "ua:" stands for "user agent" in this case, then it seems to be a string identifying your browser, and it might have gotten into your clipboard from a badly programmed tracking script on some website you visited.
This looks like an app's internal ID (GUID) to identify an entity. Within the context of the app in question,n copy and pasting something will result in an entity with that ID being copied. But if you paste it externally to the app, you will see the entity's ID. This is a common technique for app development.
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've an app that uses the LocationManager in Android and i'm tryng to get the current time provided by gps in millis.
I noticed in my database a row with a wrong timestamp.
There's others that are always corrected, for example:
1477050084629: Correct time provided
6406148: Incorrect time provided
The incorrect time is provided by using a device Samsung SM-J105B (Galaxy J1 Mini Dual Chip).
I didn't find topics related a problem like this, only problems when the time is different by hours or days.
In my case the timestamp return a number of small quantity of digits.
I think the problem would be generated by device, see this topic:
https://support.strava.com/hc/en-us/articles/216515918-My-Activity-has-the-wrong-date-
I'm assuming a bigint column. Ask yourself is one bit not set on a binary number? Look at the code that uses that column then look specifically how the value is passed in code is it serialized when it's passed to your code? Check if the value is converted to and from human readable timestamps.
I hope this question isnt going to be down-flagged for not showing some actual code, but thats the core of this situation. I simply have no clue where to start to solve this issue, even after trying to use several combinations of keywords on both Google, and here on SO.
My client suddenly decided that half of the Android App I'm developing for him has to be Chinese, so after I have made some changes in the Database so some fields can take in Simplified Chinese character sets, I need to make sure that my client (living in holland) only uses those characters in that particular EditText field in the app. (There are more Database fields that now only allow Simplified Chinese, however these values come from a dropdown list in the app, so I dont need to worry about wrong characters for them).
So how would one make sure that only Simplified Chinese is used in an EditText field?
Here is a project in Ruby that attempts to detect whether characters are Traditional Chinese, Simplified Chinese, or Japanese (maybe others?): https://github.com/jpatokal/script_detector
This detection is based on the Unihan Database, in which there is a file called Unihan_Variants.txt. (Download zip file containing this text file here.)
Conceivably, you could parse the txt file into a lookup table and check the unicode value as the text is entered during onTextChanged() for your EditText. However, the readme on the project linked above states: "It is important to understand that this requires long sections of text to work reliably, since a single character or even several characters may be valid Japanese, traditional Chinese and simplified Chinese simultaneously." So, weeding out characters on an individual basis might prove difficult.
This question is not specific to Android but I have included the tag.
I need to be able to store phone numbers in some sort of standard form (ideally a string) where equality can be tested/evaluated quickly (hence a string would be ideal)
I found some answers already, the best ones pointed to http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html (I'm fine with using a library to do it for me)
BUT this isn't really good enough, I've tried a variety of format numbers, learnt about the Editable factory to use some of the static methods in that class, but they don't seem to return the form I was expecting.
I was expecting something like a phone-number-hash, that two inputs representing the same number would yield the same in this "standard form" and that one could dial this standard form and be fine. I thought that all the various +s and whatnot would be short-hands for this standard form.
I'm not sure if such a thing exists now.
I understand that some things mean "current area" (or country) which is why land-lines can ommit area codes, I expected a function that would return the format for the current location (but this doesn't apply to mobiles, if it were a land line to prepend the area code for example, this would be (closer) to the "standard form" I keep assuming exists)
I am pretty sure that some full-form for phone numbers exists, thinking about how the telephone system works (which I infer I admit) there ought to be a form that identifies a number uniquely across the whole planet, and when this is not the case (such as local calls from land-lines without area codes) it is an optimisation.
So I have two questions:
How can I "expand" a phone number to a unique string for that number, such that any alternate forms of writing that number (with spaces, an 0 or +44....) "expand" to this unique number?
Are there any ISO(/IEC?) (what's the O stand for?) standard documents with drafts open to the public? I've read the Wikipedia page (ages ago, I've spent so many hours wiki-browsing, and opened hundreds of tabs) but it covers history, or some information on formatting), I'd like to know more about the thing I've taken for granted now for some 8 years or so.
Additionally, why is Windows Phone 8 a tag? To make the 12 proud Lumina owners not feel left out? (It was suggested as a tag!)
Addendum
Unfortunately Any API in android to normalize phone number there are no solutions there (this includes libphonenumber) and my quest to find out has lead to some interesting reads:
http://en.wikipedia.org/wiki/Panel_switch
http://en.wikipedia.org/wiki/Nonblocking_minimal_spanning_switch
http://en.wikipedia.org/wiki/Telephone_exchange
and I still cannot conclude there isn't some "full form" for numbers.
I dare not create a solution that simply swaps +44 for an 0 and such.
After reading your question, I was reminded of Google's library called libphonenumber. Its Google's common library for parsing, formatting, storing and validating international phone numbers. It does the following things ( some of which seem what you might be able to use):
Parsing/formatting/validating phone numbers for all countries/regions
of the world.
getNumberType - gets the type of the number based on
the number itself; able to distinguish Fixed-line, Mobile, Toll-free,
Premium Rate, Shared Cost, VoIP and Personal Numbers (whenever
feasible).
isNumberMatch - gets a confidence level on whether two
numbers could be the same.
isPossibleNumber - quickly guessing whether a number is a possible
phonenumber by using only the length information, much faster than a
full validation.
isValidNumber - full validation of a phone number
for a region using length and prefix information.
AsYouTypeFormatter - formats phone numbers on-the-fly when users enter each digit.
PhoneNumberOfflineGeocoder - provides geographical information related to a phone number.
As far as international format of phone number is concerned, E.164 format is an recommended by International Telecommunication Union. It defines a numbering plan for the world-wide public switched telephone network and is a general format for international telephone numbers ( usually stats with + followed by country code, Area code and the number).
Using the above library, validity of all the phone numbers can be checked if you mention the international code along with the phone number ( example 1 for US & Canada). If you don't have the code but you know the country's name for which you want to check the number, then also you can validate. You can also convert all the valid numbers of 1 standard E.164 format using this library. You can also 'expand' a number in Local National format of that particular country. You can save it as String as well. Although it does use PhoneNumberUtils that you mentioned in your question.
I am not sure if this is what you are looking for but I hope this information helps you.
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.