Android Open Source - android.app.niuz.io Phone Service






From Project

Back to project page android.app.niuz.io.

License

The source code is released under:

GNU General Public License

If you think the Android project android.app.niuz.io listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package io.niuz.services;
/*w ww.j  a  v  a  2  s .  co m*/
import android.content.Context;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.widget.Toast;

public class PhoneService {
  private static String phoneNumber;
  
  public static void initPhoneNumber(Context context) {
    if (phoneNumber != null) {
      return;
    }
    
    TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
    phoneNumber = (telephonyManager.getDeviceId() != null 
        ? telephonyManager.getDeviceId() 
        : Secure.getString(context.getContentResolver(), Secure.ANDROID_ID));
  }
  
  public static String getPhoneNumber() {
    return PhoneService.phoneNumber;
  }
  
  public static void toast(String message, Context context) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.show();
  }
}




Java Source Code List

io.niuz.CategoriesSelectionActivity.java
io.niuz.CompanyInformationLoadingActivity.java
io.niuz.MainActivity.java
io.niuz.NewsCompaniesSelectionActivity.java
io.niuz.NewsHeadersActivity.java
io.niuz.NewsReaderActivity.java
io.niuz.PreMainActivity.java
io.niuz.model.APIRetrievalStatus.java
io.niuz.model.CategoryInformation.java
io.niuz.model.CompanyInformation.java
io.niuz.model.InitUserStatus.java
io.niuz.model.News.java
io.niuz.services.BaseService.java
io.niuz.services.CategoriesSubcategoriesService.java
io.niuz.services.CompaniesService.java
io.niuz.services.NewsService.java
io.niuz.services.PhoneService.java
io.niuz.services.UserService.java