我如何保存Play商店安装应用程序ID?

时间:2013-06-23 11:28:41

标签: android

在我的应用程序中我给用户一个搜索按钮来搜索来自googleplay商店的应用程序并将该应用程序名称保存在数据库中,以便我在我的代码中编写playstore url 所以当用户打开playstire时发现任何产品并安装我只想保存那个eproduct id保存在数据库中我该怎么做 ?我如何只从url中保存sepcific项目?

Uri uri = Uri.parse("https://play.google.com/store/apps");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

当用户点击此按钮播放商店打开假设用户searcj产品并安装哪个网址

https://play.google.com/store/apps/details?id=com.imangi.templerun2&    
feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5pbWFuZ2kudGVtcGxlcnVuMiJd

如何将此ul的id格式保存到id=com.imangi.templerun2

的数据库中

1 个答案:

答案 0 :(得分:1)

String url = "https://play.google.com/store/apps/details?id=com.imangi.templerun2&    
feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5pbWFuZ2kudGVtcGxlcnVuMiJd";

String[] splited =  url.split("&");
String[] id = splited[0].split("?id=");
// your id[1] will equal = com.imangi.templerun2