Shared Preferences in WebView
<p>I want to limit how many songs a user can download in my FREE app. The download is executed everytime a user clicks on a link that ends with /download/. I can't seem to wrap my head around how to get this to work with shared preferences. When testing I was able to download a file at least 5 times so it obviously didn't work. Here is a snippet of what I am doing:</p>

<pre><code>else if (url.startsWith("http://xxxxxx.com/songs2/Music%20Promotion/Download/")) {
            prefs2 = getSharedPreferences("downloadlimit", 0);
            editor = prefs2.edit();
            long launch_count = prefs2.getLong("launch_count", 0) + 1;
            editor.putLong("launch_count", launch_count);

            if (launch_count &gt;= 2) {                    
                    showRateDialog(getApplicationContext(), editor);
                }
</code></pre>
