{"id":163397,"date":"2012-12-20T22:26:03","date_gmt":"2012-12-20T18:26:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=163397"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=163397","title":{"rendered":"<span class=\"post_title\">\u041f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 Android Market<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 Android Market \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 (\u0441 \u0448\u0430\u0445\u043c\u0430\u0442\u0430\u043c\u0438 \u0438 \u043f\u043e\u044d\u0442\u0435\u0441\u0441\u0430\u043c\u0438).<br \/>  \u0421\u0432\u043e\u0439 \u043c\u0430\u0440\u043a\u0435\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0448\u0430\u0442\u044c \u0434\u0432\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:  <\/p>\n<ul>\n<li>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Google Play. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043f\u043e \u0435\u043c\u0430\u0439\u043b\u0443, \u0447\u0442\u043e \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e. <\/li>\n<li>\u0411\u0435\u0442\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043a\u043e\u043b\u043b\u0435\u0433, \u0441 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u044c\u044e. <\/li>\n<\/ul>\n<p>  \u0418 \u0442\u0430\u043a, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\/\u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h4>\n<p>  \u0421\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c (\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043e\u0442\u0447\u0435\u0442\u044b, \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c), \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0441\u0442\u043e xml \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code class=\"xml\">&lt;MyMarket&gt;     &lt;application name=&quot;TestApp1&quot;      package=&quot;com.example.testapp1&quot;     versionCode=&quot;1&quot;     versionName=&quot;1.0&quot;      url=&quot;http:\/\/mobile.....\/android\/download\/TestApp1.apk&quot;\/&gt; ..... &lt;\/MyMarket&gt;  <\/code><\/pre>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 http \u0448\u0430\u0440\u0430.<br \/>  \u0414\u0430\u043d\u043d\u044b\u0439 xml \u0444\u0430\u0439\u043b \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e\u0435 \u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442, <br \/>  \u041c\u0430\u0440\u043a\u0435\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 apk \u0444\u0430\u0439\u043b \u043d\u0430 \u0444\u043b\u0435\u0448\u043a\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432.<br \/>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0432 \u0444\u043e\u043d\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"java\">\t\t\tURL url = new URL(apkurl); \t\t\tHttpURLConnection c = (HttpURLConnection) url.openConnec\u0432\u043b\u0435\u043dtion(); \t\t\tc.setRequestMethod(&quot;GET&quot;); \t\t\tc.setDoOutput(true); \t\t\tc.connect();  \t\t\tFile file = this.getExternalFilesDir(&quot;download&quot;); \t\t\tFile outputFile = new File(file, &quot;app.apk&quot;); \t\t\tFileOutputStream fos = new FileOutputStream(outputFile); \t\t\tInputStream is = c.getInputStream();  \t\t\tbyte[] buffer = new byte[1024]; \t\t\tint len1 = 0; \t\t\twhile ((len1 = is.read(buffer)) != -1) { \t\t\t\tfos.write(buffer, 0, len1); \t\t\t} \t\t\tfos.close(); \t\t\tis.close(); \t\t\t \t\t\tIntent intent = new Intent(Intent.ACTION_VIEW); \t\t\tintent.setDataAndType(Uri.fromFile(outputFile), \t\t\t\t\t&quot;application\/vnd.android.package-archive&quot;); \t\t\tstartActivity(intent); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0438\u0434\u0438\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<br \/>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/4117\/1154545.a5\/0_7d3c3_bd08d241_L\" alt=\"image\"\/><\/p>\n<h4>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Market \u043c\u043e\u0436\u0435\u0442 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439, \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:  <\/p>\n<pre><code class=\"java\">\tprivate boolean checkNewVersion(String packageName, int versionCodeNew) { \t\tList&lt;ApplicationInfo&gt; apps = getPackageManager() \t\t\t\t.getInstalledApplications(0); \t\tfor (int i = 0; i &lt; apps.size(); i++) { \t\t\tApplicationInfo app = apps.get(i); \t\t\tif (packageName.equals(app.packageName)) { \t\t\t\tPackageManager manager = getPackageManager(); \t\t\t\tPackageInfo info; \t\t\t\ttry { \t\t\t\t\tinfo = manager.getPackageInfo(app.packageName, 0); \t\t\t\t\tint versionCode = info.versionCode; \t\t\t\t\tif (versionCodeNew &gt; versionCode) { \t\t\t\t\t\tToast.makeText(this, &quot;New Version!&quot;, Toast.LENGTH_LONG) \t\t\t\t\t\t\t\t.show(); \t\t\t\t\t\treturn true; \t\t\t\t\t} \t\t\t\t} catch (NameNotFoundException e) { \t\t\t\t\te.printStackTrace(); \t\t\t\t} \t\t\t} \t\t} \t\treturn false; \t}  <\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e.<\/p>\n<h4>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432\u044b\u0438\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"java\">\t\tUri packageURI = Uri.parse(&quot;package:&quot;+packageName); \t\tIntent intent = new Intent(Intent.ACTION_DELETE, packageURI); \t\tstartActivity(intent);  <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/4134\/1154545.a5\/0_7d3c5_830496a8_L\" alt=\"image\"\/><\/p>\n<h4>\u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c<\/h4>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043b\u043e\u0433\u043e\u043c \u043e\u0448\u0438\u0431\u043a\u0438, \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0431\u043e\u0440\u0430 \u044d\u0442\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u041c\u0430\u0440\u043a\u0435\u0442.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448 \u041c\u0430\u0440\u043a\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441  <\/p>\n<pre><code class=\"java\">public class CustomExceptionHandler implements UncaughtExceptionHandler { \tprivate File logsFolder = null;     public static final String ERROR_INTENT = &quot;com.example.markettestapp1.SEND_ERROR&quot;; \tpublic CustomExceptionHandler(File logsFolder) { \t\tthis.logsFolder = logsFolder; \t} \t@Override \tpublic void uncaughtException(Thread thread, Throwable ex) { \t    final Writer result = new StringWriter(); \t    final PrintWriter printWriter = new PrintWriter(result); \t    ex.printStackTrace(printWriter); \t    String stacktrace = result.toString(); \t    printWriter.close(); \t\ttry { \t\t\tif (!logsFolder.exists()) { \t\t\t\tlogsFolder.createNewFile(); \t\t\t} \t\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(logsFolder, true)); \t\t\twriter.write(&quot;&quot;+new Date()+&quot;\\n&quot;+stacktrace); \t\t\twriter.close(); \t\t} catch (IOException e) { \t\t\te.printStackTrace(); \t\t} \t\t \t\tIntent intent = new Intent(); \t\tintent.setAction(ERROR_INTENT); \t\tintent.putExtra(&quot;packageName&quot;, Test1Application.getApplication().getPackageName()); \t\tintent.putExtra(&quot;stacktrace&quot;, stacktrace); \t\tTest1Application.getInstanceApplication().sendBroadcast(intent); \t\t \t\tandroid.os.Process.killProcess(android.os.Process.myPid()); \t} } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043a\u043e\u0434\u0430, \u044d\u0442\u043e \u0445\u0435\u043d\u0434\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 (Exception), \u0433\u0435\u043d\u0435\u0440\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043e \u0441\u0442\u0435\u043a\u043e\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0431\u0440\u043e\u0430\u0434\u043a\u0430\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0410 \u0432 Application \u043a\u043b\u0430\u0441\u0441\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u0432\u0441\u0435\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0432 \u044d\u0442\u043e\u0442 \u0445\u0435\u043d\u0434\u043b\u0435\u0440  <\/p>\n<pre><code class=\"java\">public class Test1Application extends Application { \t@Override \tpublic void onCreate() { \t\tsuper.onCreate(); \t\tapplication = this; \t\tThread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(new File(this.getApplicationContext().getExternalFilesDir(null),&quot;exceptions.log&quot;))); \t}  <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u0441\u043c\u0435\u0440\u0442\u044c\u044e \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043b\u043e\u0433 \u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0431\u0440\u043e\u0430\u0434\u043a\u0430\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043c\u0430\u0440\u043a\u0435\u0442.,<br \/>  \u041f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0443, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f (\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f).<\/p>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u041c\u0430\u0440\u043a\u0435\u0442\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"java\">public class SendErrorReceiver  extends BroadcastReceiver {     public static final String ERROR_INTENT = &quot;com.example.markettestapp1.SEND_ERROR&quot;;     @Override     public void onReceive(Context context, Intent intent) {         Intent i = new Intent(context, SendErrorActivity.class);         i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);         i.putExtra(&quot;stacktrace&quot;, intent.getStringExtra(&quot;stacktrace&quot;));         i.putExtra(&quot;packageName&quot;, intent.getStringExtra(&quot;packageName&quot;));         context.startActivity(i);     } }   <\/code><\/pre>\n<p>  AndroidManifest.xml:  <\/p>\n<pre><code class=\"xml\">        &lt;receiver android:name=&quot;com.example.markettestapp1.SendErrorReceiver&quot; android:enabled=&quot;true&quot; &gt;             &lt;intent-filter&gt;                 &lt;action android:name=&quot;com.example.markettestapp1.SEND_ERROR&quot; &gt;                 &lt;\/action&gt;             &lt;\/intent-filter&gt;         &lt;\/receiver&gt;  <\/code><\/pre>\n<p>  \u0418 \u0434\u0430\u043b\u044c\u0448\u0435 \u043c\u0430\u0440\u043a\u0435\u0442 \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u0439 \u043d\u0438\u0431\u0443\u0434\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a \u043e\u0448\u0438\u0431\u043a\u0435<br \/>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/4121\/1154545.a5\/0_7d3c4_5b504bb_L\" alt=\"image\"\/><\/p>\n<p>  \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043c\u043d\u043e\u0433\u0438\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0434\u043b\u044f \u0431\u0435\u0442\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u0431\u043e\u0440\u0443 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>  ps: \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432\u0437\u044f\u0442\u044b\u0435 \u0438\u0437 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/163397\/\"> http:\/\/habrahabr.ru\/post\/163397\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 Android Market \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 (\u0441 \u0448\u0430\u0445\u043c\u0430\u0442\u0430\u043c\u0438 \u0438 \u043f\u043e\u044d\u0442\u0435\u0441\u0441\u0430\u043c\u0438).<br \/>  \u0421\u0432\u043e\u0439 \u043c\u0430\u0440\u043a\u0435\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0448\u0430\u0442\u044c \u0434\u0432\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:  <\/p>\n<ul>\n<li>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Google Play. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043f\u043e \u0435\u043c\u0430\u0439\u043b\u0443, \u0447\u0442\u043e \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e. <\/li>\n<li>\u0411\u0435\u0442\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043a\u043e\u043b\u043b\u0435\u0433, \u0441 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u044c\u044e. <\/li>\n<\/ul>\n<p>  \u0418 \u0442\u0430\u043a, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\/\u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-163397","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/163397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=163397"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/163397\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=163397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=163397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=163397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}