Android: How to getNetworkOperatorName and location from incomming/outgoing number? - android

I am Developing a simple application on CallLog.Calls. I am also following Calllog.Calls .I am Getting all the call details like.. callername , caller number , calltime , duration..etc. As per the requirement I need to check the unknown number location/caller networkprovidername like TruecallerApp and like this image
In short I want to know how can i get or trace the Caller Locationprovidername from the incomming/outgoing number in android programatically ???Is there any database i need to create with all the related data or any other way to solve this?? By using telephonymanager.getNetworkOperatorName() i can get the own device operator name similliraly i want to get for other number. Any Idea Please Rply soon .
Thank you :)

Related

android comparing text to save image and send via bluetooth

i make a project for hearing impaired people ,where two devices are connected via bluetooth , its already working sending and receiving messages but what i want is when i type a text "hi" in a editext and when i click the send button the display would be the picture in a right(girl picture) but if that picture is not available display the second picture in left side(hand sign) , is this possible? can i compare the txt i type to the drawable folder image so that , that particular image will display?... ..
plz share ur idea....
Then you will need the following:
get the text (Hi) before displaying it, by getText
check the availability of the image either you want it to be available in phone 1 or phone 2 by this method
Sure it is possible to send an image via Bluetooth, also you can code it as this example
Also my opinion is to upload the image to the firebase or let it with your application if you need it for much use
Edit : compairing file name with string that you want is like is
boolean fileExists = new File("path/to/" + name + ".png").isFile();
where name if the chat message you want to compare and surely, that code occurs before the texts/images are displayed to the users

Implementing OR Condition using Parse Android SDK?

I am new to Parse and i am working on a Project that uses Android PARSE Sdk so i was wondering on how can i make a where query with or condition using the android sdk.
I want to make a query like this [Psuedo code]
Select * from employ where employId is ("1","2","3")
I found this on parse documentation, i don't know if it helps or not.
Edit:
This is what i found on PARSE but its not working
String[] id= {"1","2","3"};
query.whereContainedIn("employId ", Arrays.asList(id));
It returns me an empty list but if i query them one by one i get result... Can anyone tell me whats wrong ?
You can use whereContainedIn to select specific rows. See this post you can get more ideas. https://www.parse.com/questions/different-arrays-and-wherecontainedin-for-android.
List<String> employId = new ArrayList<String>();
employId.add("1"); employId.add("2"); employId.add("2");
query.whereContainedIn("employId", employId);
If you are still not clear. check this https://www.parse.com/docs/android_guide#queries
I have found the solution and i must say its pretty lame of PARSE to not mention this anywhere in there documentation.
The problem was that the values that i was using inwhereContainedIn method were of type String but in reality they were pointers to another table's row.
I was trying to get the values using only there ids[as it is displayed on parse] but instead i had to pass the whole object in order to retrieve them. That was the reason on why it was returning empty list.
The thing is Even though it displays IDs [pointer to object in a table] we cant search using only ID's instead we have to use complete Parse objects if we want to search a table based on Specific Object.

Android autofocus

I am new to android and just created an android application consisting of many images and a few buttons suppose like john, what I want is whenever a person clicks on john, all the images with names including john will get highlighted.
Thanks in advance.
for exmple of Jhon:
Just follow the steps:
1)setOnItemClickListener on images
from that you find all about the selected image throgh function get getResources()
you can fetch the name from that.
2)After fetchting the name fire one query like "selected name "
it should display result name "Jhon"
3)Display name picture as per your requirement.
or
4)If you want to display into the same you can
let me know if you have any query for it.

get unique call details from CallLog

I am trying to access call logs in android application , here i am getting all call details but i want unique call details only , i don't want repeated values.
is there any way to get unique call log details in android ?
Get all call details and add them in Set. Set does not allow dupes.
Idea and guess:
If you are extracting each detail differently you might find easier to use Map and then add the keySet() to the Set data and then again you populate the map.
Remember in CallLog you might find same key (let's say Contact name) but different data for that call (Time, duration etc etc).

Android create contact problem

Hi
I wan to create a contact, so here is my code:
Intent addPersonIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
addPersonIntent.putExtra(Insert.NAME, "asd");
addPersonIntent.setType(Contacts.People.NAME);
addPersonIntent.putExtra(Insert.PHONE_TYPE, Contacts.Phones.TYPE_WORK);
addPersonIntent.putExtra(Insert.PHONE, Uri.decode("123"));
addPersonIntent.putExtra(Insert.PHONE_TYPE, Contacts.Phones.TYPE_MOBILE);
addPersonIntent.putExtra(Insert.PHONE, Uri.decode("123"));
addPersonIntent.setType(Contacts.Phones.CONTENT_ITEM_TYPE);
...
startActivity(addPersonIntent);
Why the only thing that is created is the mobile number, I never got the "work" number?
You're thinking of "putExtra" as adding to the end of an array - Your problem will be clearer if you think of it as setting name/value pairs in a hashtable. Basically, you're setting PHONE_TYPE to "work", PHONE to 123, PHONE_TYPE to "mobile" (overwriting when it was set to work), and PHONE to "123" again.
What you want to do is set either the "mobile" or "work" phone data using SECONDARY_PHONE and SECONDARY_PHONE_TYPE - Details here.
Also, keep in mind that all this follows the old version of the Contacts API, which is deprecated as of Android 2.0+. There's a handy resource on migrating your code to use the new contacts API here.
here is the next problem, when I add:
addPersonIntent.putExtra(Insert.NOTES, "asdkjhaskh");
the note data never appears in the activity, why?
The whole idea is to start the EditContactActivity.java with loaded data and for now I loaded phones, names and companies. For some reason I cant load notes, and another problem is how to set in the intent information for the IM? For example I tryed with:
addPersonIntent.putExtra(Insert.IM_HANDLE, "mySkype");
addPersonIntent.putExtra(Insert.IM_PROTOCOL, Uri.decode("skype"));
but it is not working.

Categories

Resources