- How do I use non public classes in Android like telephony,
android.telephony.CallManager
in my Android application? - How do I import this telephony packages in my开发者_JS百科 activity class and make it allow to access its functionality?
if you only need to call/send sms then you can use the Intent: call:
Intent i = new Intent(Intent.ACTION_CALL); i.setData(Uri.parse("tel:" + phonenumber)); context.startActivity(i);
sms:
Intent i = new Intent(Intent.ACTION_VIEW); i.setType("vnd.android-dir/mms-sms"); i.putExtra("sms_body", "message"); i.setData(Uri.parse("sms:" + phonenumber)); context.startActivity(i);
this was enough for me. if it isn't enough for you, you can use the TelephonyManager.
read more at here
as you can see, it is public. its just not initiate as new TelephonyManger();
but via getSystemService(TELEPHONY_SERVICE).
you can always use reflection if you will need some private class.
精彩评论