Back to project page android.app.niuz.io.
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.
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(); } }