How to check DND status of a mobile number in Android? - android

I have an application built that works for checking DND Status, it has an edittext field and a button. In edittext the user enters a mobile number and on click of button I want to check the DND status of in android. How to check DND status of a mobile number?
<EditText
android:id="#+id/edtNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txtHeading"
android:layout_centerHorizontal="true"
android:ems="10"
android:inputType="number"
android:maxLength="12">
<requestFocus />
</EditText>
<Button
android:id="#+id/btnCheckCheckDND"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/edtNumber"
android:layout_centerHorizontal="true"
android:text="Check Status"
/>

For DND check you need a membership of TRAI http://www.nccptrai.gov.in/nccpregistry/ then TRAI provide you all DND active database in CSV formate.
Also you can use third part toll of http apis eg. http://checkdnd.com/api/check_dnd_no_api.php?mobiles=9999999999
Free DND Check API

Related

Google play resource override string value

I have app that supports few languages. When I use one of supported languages everything works pretty well, but when I use default language (phone on unsupported language(hebrew)) one of my strings overrides by string from play services package. As the result this specific string translates to unsupported language.(Hebrew) Resource path looks usual.
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="#dimen/margin_10dp"
android:layout_toRightOf="#+id/iconFeedback"
android:elevation="3dp"
android:text="#string/accept"
android:textAlignment="center"
android:textSize="16dp"
android:textColor="#color/white" />
Why it can happens?
Thanks in advice

Android custom fonts (nunito) not set properly in TextView

I am using custom fonts in my android TextView.
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
txt2= (TextView) findViewById(R.id.txt2);
txt2.setTypeface(tf);
But padding between lines are not properly show.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Here is my output :
I also tried with following code :
android:includeFontPadding="false"
but still same issue. Not sure but I also tried to use justifyTextView from Here but same issue. Does anybody faced same issue before?
Thanks in advance.
EDIT :
If i use android:lineSpacingExtra 1st line have more space then other lines. Here is my code and output.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:lineSpacingExtra="#dimen/_5sdp" <<<<<<<
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Late to the party on this - we had exactly the same issue, was fixed completely by replacing the .ttf font file with the latest from Google Fonts - there's a bad early version of this font doing the rounds. Don't forget to remove any android:lineSpacingMultiplier fudges you've put in place int he meanwhile.
Add linespacingMultiplier in your XML
<TextView
android:id="#+id/textview_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#android:color/black"
android:lineSpacingMultiplier="3"
android:textSize="#dimen/_15sdp" />
Or
Add these line in your code:-
mTextViewFont=(TextView)findViewById(R.id.textview_font);
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mTextViewFont.setLineSpacing((float) 5.5,(float) 1.2);
}
mTextViewFont.setTypeface(tf);
There was issue in the font file that is because of the site from where you downloaded it. I download the file from
dafontfree.net/download-nunito-f92263.htm
and then replace your file from asset folder.
and this is the output of it.

Registrating with only #csus.edu email

I am building a registration page for a carpool app and I would like to only have a school email address used in the registration. How to input #csus.edu email into Android Studio app?
Currently I have:
<TextView
android:layout_width="wrap_content"
android:text="Email"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/etEmail"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content" />
Don't let them type it, and don't make it appear in the input box.
Something like:
Name: [text box] #csus.edu
so in this case, "Name:" and "#csus.edu" are both labels.
Client side validation. Just Substring whatever they enter
String end = EmailInput.substring(EmailInput.length() - 9, EmailInput.length());
boolean isValid = end.equals("#csus.edu);
That being said, I also agree with ergonaut in that save the user the time and trouble by not giving the option to enter a wrong email.

Appium locators don't work with saucelabs Android

I have UI component:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fire Event"
android:id="#+id/fireEvent"
android:layout_below="#+id/buttonViewKruxWebPage"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="43dp" />
And I want to find it using Appium ID locator:
driver.findElement(By.id("fireEvent")). It works fine locally but Appium cannot find it on Saucelabs. Locally and Remotely on Sauselabs both cases I have Appium 1.4.0.
Also i have tried variant of lacator:
driver.findElement(By.id("com.example.package:id/txtLogin"))
How long do you wait for element to appear in findElement method? It is possible that Saucelabs has bigger delays so I would suggest to increase time-outs and see what happens.

Phone number formatting in EditText

I have been trying to get
XML File
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/phoneEditText"
android:layout_marginTop="10dp"
android:padding="16dp"
android:inputType="phone"/>
Java
etContact = (EditText)findViewById( R.id.phoneEditText );
etContact.addTextChangedListener(new PhoneNumberFormattingTextWatcher() );
To successfully format the number entered by the user but it fails to perform the formatting on my Nexus 5 test device, while on lower API levels it does work. I am not sure if this has been changed of phased out since KitKat but it refuses to work now. Is there a work around or additional calls to enable this to work on KitKat?

Categories

Resources