温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Android中怎么调用平台功能

发布时间:2021-06-24 16:13:34 来源:亿速云 阅读:117 作者:Leah 栏目:移动开发

这篇文章给大家介绍Android中怎么调用平台功能,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

Android调用平台功能之显示网页

Uri uri = Uri.parse("http://google.com");   Intent it = new Intent(Intent.ACTION_VIEW, uri);   startActivity(it);   Uri uri = Uri.parse("http://google.com");   Intent it = new Intent(Intent.ACTION_VIEW, uri);   startActivity(it);

Android调用平台功能之显示地图

  1. Uri uri = Uri.parse("geo:38.899533,-77.036476");   

  2. Intent it = new Intent(Intent.ACTION_VIEW, uri);   

  3. startActivity(it);   

  4. //其他 geo URI 範例   

  5. //geo:latitude,longitude   

  6. //geo:latitude,longitude?z=zoom   

  7. //geo:0,0?q=my+street+address   

  8. //geo:0,0?q=business+near+city   

  9. //google.streetview:cbll=lat,lng&cbp=1,yaw,,pitch,
    zoom&mz=mapZoom   

  10. Uri uri = Uri.parse("geo:38.899533,-77.036476");   

  11. Intent it = new Intent(Intent.ACTION_VIEW, uri);   

  12. startActivity(it);   

  13. //其他 geo URI 範例   

  14. //geo:latitude,longitude   

  15. //geo:latitude,longitude?z=zoom   

  16. //geo:0,0?q=my+street+address   

  17. //geo:0,0?q=business+near+city   

  18. //google.streetview:cbll=lat,lng&cbp=1,yaw,,pitch,
    zoom&mz=mapZoom 

Android调用平台功能之拨打电话

//叫出撥號程式   Uri uri = Uri.parse("tel:0800000123");   Intent it = new Intent(Intent.ACTION_DIAL, uri);   startActivity(it);   //直接打電話出去   Uri uri = Uri.parse("tel:0800000123");   Intent it = new Intent(Intent.ACTION_CALL, uri);   startActivity(it);   //用這個,要在 AndroidManifest.xml 中,加上   //< uses-permission id="android.permission.CALL_PHONE" />   //叫出撥號程式   Uri uri = Uri.parse("tel:0800000123");   Intent it = new Intent(Intent.ACTION_DIAL, uri);   startActivity(it);   //直接打電話出去   Uri uri = Uri.parse("tel:0800000123");   Intent it = new Intent(Intent.ACTION_CALL, uri);   startActivity(it);   //用這個,要在 AndroidManifest.xml 中,加上   //< uses-permission id="android.permission.CALL_PHONE" />

Android调用平台功能之发送SMS/MMS

  1. //需写号码SMS   

  2. Intent it = new Intent(Intent.ACTION_VIEW);   

  3. it.putExtra("sms_body", "The SMS text");   

  4. it.setType("vnd.android-dir/mms-sms");   

  5. startActivity(it);   

  6. //发送SMS   

  7. Uri uri = Uri.parse("smsto:0800000123");   

  8. Intent it = new Intent(Intent.ACTION_SENDTO, uri);   

  9. it.putExtra("sms_body", "The SMS text");   

  10. startActivity(it);   

  11. //发送MMS   

  12. Uri uri = Uri.parse("content://media/external
    /images/media/23");   

  13. Intent it = new Intent(Intent.ACTION_SEND);   

  14. it.putExtra("sms_body", "some text");   

  15. it.putExtra(Intent.EXTRA_STREAM, uri);   

  16. it.setType("image/png");   

  17. startActivity(it);   

  18. //需写号码SMS   

  19. Intent it = new Intent(Intent.ACTION_VIEW);   

  20. it.putExtra("sms_body", "The SMS text");   

  21. it.setType("vnd.android-dir/mms-sms");   

  22. startActivity(it);   

  23. //发送SMS   

  24. Uri uri = Uri.parse("smsto:0800000123");   

  25. Intent it = new Intent(Intent.ACTION_SENDTO, uri);   

  26. it.putExtra("sms_body", "The SMS text");   

  27. startActivity(it);   

  28. //发送MMS   

  29. Uri uri = Uri.parse("content://media/external/
    images/media/23");   

  30. Intent it = new Intent(Intent.ACTION_SEND);   

  31. it.putExtra("sms_body", "some text");   

  32. it.putExtra(Intent.EXTRA_STREAM, uri);   

  33. it.setType("image/png");   

  34. startActivity(it); 

关于Android中怎么调用平台功能就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI