android - Install apk file programmatically -
i have downloaded apk file localhost server using download manager api , displaying have downloaded file thing if click .apk file, unable install, give parsing package error. xml page
<button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onclick="onclick" android:text="start download" > </button> <button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onclick="showdownload" android:text="view downloads" > </button>
and here code
broadcastreceiver broad = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { // todo auto-generated method stub string action = intent.getaction(); if (downloadmanager.action_download_complete.equals(action)) { long downloadid = intent.getlongextra( downloadmanager.extra_download_id, 0); query query = new query(); query.setfilterbyid(enqueue); cursor c = dm.query(query); if (c.movetofirst()) { int columnindex = c .getcolumnindex(downloadmanager.column_status); if (downloadmanager.status_successful == c .getint(columnindex)) { // imageview view = (imageview) // findviewbyid(r.id.imageview1); final string uristring = c .getstring(c .getcolumnindex(downloadmanager.column_local_uri)); // search.setimageuri(uri.parse(uristring)); } } } } }; registerreceiver(broad, new intentfilter( downloadmanager.action_download_complete)); public void showdownload(view view) { intent = new intent(); i.setaction(downloadmanager.action_view_downloads); startactivity(i); }
what procedure there install apk file there in downloadmanager?
Comments
Post a Comment