Coder Social home page Coder Social logo

discreet-app-rate's People

Contributors

d4rken avatar easycheese avatar jacob9elements avatar kozaxinan avatar mariusvolkhart avatar mikepenz avatar pomepuyn avatar writtmeyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discreet-app-rate's Issues

View.setBackground is available only for API level 16 and above

I get the following exception report:

java.lang.NoSuchMethodError: android.view.View.setBackground
at fr.nicolaspomepuy.discreetapprate.AppRate.showAppRate(AppRate.java:568)
at fr.nicolaspomepuy.discreetapprate.AppRate.checkAndShow(AppRate.java:355)

To get rid of it I set the following two lines to use setBackgroundDrawable method (although I know it might not be the best fix):

close.setBackground(activity.getResources().getDrawable(R.drawable.selectable_button_light));
close.setBackground(activity.getResources().getDrawable(R.drawable.selectable_button_dark));

Not showing

I'm using eclipse and had added this a library to my project, but it isn't showing for some reason.

"firstInstallTime" not available in Froyo

According to this StackOverflow thread:
http://stackoverflow.com/questions/2831333/how-to-get-app-install-time-from-android
the "firstInstallTime" field is available from API level 9 (Gingerbread). Inside the AppRate class (line 323), however, there's a check for Froyo (API level 8), which I think is wrong.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO)
In fact, my crash reporting system has just sent me a report of NullPointerException at this line:
if (now.getTime() - installDate.getTime() < installedSince) {
My guess is that installDate is null at this point...

Add support for other Android markets as well.

Add support for Amazon AppStore, Blackberry AppWorld (BB10 devices), Samsung Apps.

The algorithm should be:

  1. Is Google Play installed => rate via Google Play.
  2. Is Amazon AppStore installed => rate via Amazon AppStore.
  3. etc.

Intents to be used:
// Amazon AppStore
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse("http://www.amazon.com/gp/mas/dl/android?p=" + packageName));
activity.startActivity(intent);
// More info at https://developer.amazon.com/appsandservices/resources/marketing-tools/using-badges
// Maybe using "amzn://android?p=" + packageName is better

// BlackBerry AppWorld
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName));
activity.startActivity(intent);

// Samsung Apps
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse("samsungapps://ProductDetail/" + packageName));
activity.startActivity(intent);
// More info at http://developer.samsung.com/android/technical-docs/Samsung-Apps-Deeplink-Guide

Crash on Android 2.2

Master branch

java.lang.NoSuchMethodError: android.content.SharedPreferences$Editor.apply
at fr.nicolaspomepuy.discreetapprate.AppRate.commitEditor(SourceFile:652)
at fr.nicolaspomepuy.discreetapprate.AppRate.incrementViews(SourceFile:464)
at fr.nicolaspomepuy.discreetapprate.AppRate.checkAndShow(SourceFile:320)

The error occurs in the code:

private void commitEditor() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
        editor.apply();
    } else {
        editor.commit();
    }
}

Change Build.VERSION_CODES.FROYO to Build.VERSION_CODES.GINGERBREAD.

Overlaps the Toolbar.

You can see on the attached image that the app rate view overlaps the Toolbar. Is it possible with the current implementation to fix this?
device-2015-04-13-014330

problem on android L

just playing around with L and stumbled uppon this:

discreteapprate_problem

a fitsSystemWindows on the right place might help

Does not work with fragments

D/DicreetAppRate﹕ initialLaunchCount incremental reached

The view never shows up. I call it on my fragments onCreateView:

AppRate.with(getActivity())
    .text(R.string.rate_message)
    .initialLaunchCount(2)
    .retryPolicy(RetryPolicy.INCREMENTAL)
    .debug(true)
    .checkAndShow();

Doesn't work with Maven?

I am trying to install it as a Maven dependency but it seems that its dependency, appcompat cannot be found.
I get the following error:
Missing artifact com.android.support:appcompat-v7:jar:+

Neither does it work on the gradle system.

Is it a repo error?

Italian translation

I translated the message to Italian. You can use it, if you like: "Ti piace? Valutalo!"

Custom UI and nested levels

Apologies for posting my question here as it is not really an issue and I didn't find a better way to contact the author.

Is it possible to have "nested" navigation in snackbar, i.e. first display : do you like app : yes / no and then depending on action -> "snackbar" displays next set of options, with logic similar to this

Also, Am I right in assumption that layout of "snackBar" is fully customized ?

Rename strings.xml

Like the user suggested in issue #13, I also just copy the source into my project. This means that I have to manually merge strings.xml.

Please could you rename strings.xml so that I can just copy as is.

For example discreet-app-rate.xml

Eclipse library project

Is there a chance that you create a library project for Eclipse? I don't use Android Studio and it's not that easy for me to use your library. For now, I just copied the source files along with the resources, but it's not the most elegant solution.

Use more beautiful libraries to show the rate bar.

The app rate bar is definitely not customizable. The height of it also fixed. It is actually better to keep it short but I think there should not be a restriction.

I think other libraries for showing alerts can be used in this library and it can be great actually.
Crouton can be used. It has to be customized a lot I think. SuperToasts may be better for this.

I think it will be more discreet :)

I can do it if it is ok. I want to discuss it here before integrating it.

Rate APP is shown multiple times

When i put my APP in the onPause stage and resume the lib does not check if there is already an Rating View shown. This results in multiple overlays of the Rate UI.

ActivityNotFoundException in simulator

Clicking on AppRate view in simulator (device which cannot handle "market" Intent) causes ActivityNotFoundException. try-catch should be used.

E/AndroidRuntime( 1395): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.mypackage }
E/AndroidRuntime( 1395): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
E/AndroidRuntime( 1395): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
E/AndroidRuntime( 1395): at android.app.Activity.startActivityForResult(Activity.java:3424)
E/AndroidRuntime( 1395): at android.app.Activity.startActivityForResult(Activity.java:3385)
E/AndroidRuntime( 1395): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839)
E/AndroidRuntime( 1395): at android.app.Activity.startActivity(Activity.java:3627)
E/AndroidRuntime( 1395): at android.app.Activity.startActivity(Activity.java:3595)
E/AndroidRuntime( 1395): at fr.nicolaspomepuy.discreetapprate.AppRate$2.onClick(AppRate.java:438)
E/AndroidRuntime( 1395): at android.view.View.performClick(View.java:4438)
E/AndroidRuntime( 1395): at android.view.View$PerformClick.run(View.java:18422)
E/AndroidRuntime( 1395): at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime( 1395): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 1395): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 1395): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 1395): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1395): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1395): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 1395): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 1395): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 447): Force finishing activity com.mypackage/com.mypackage.LiveViewActivity

Manifest merging failed

When i update from version 1.0.5 to 2.0.2, i am getting this:

[warn] [.../com.android.support-appcompat-v7-21.0.0-rc1/AndroidManifest.xml:3] Failed to parse <uses-sdk minSdkVersion='L'>: must be an integer number or codename.
[warn] [.../com.android.support-appcompat-v7-21.0.0-rc1/AndroidManifest.xml:3] Failed to parse <uses-sdk targetSdkVersion='L'>: must be an integer number or codename.
[warn] [.../com.android.support-support-v4-21.0.0-rc1/AndroidManifest.xml:3] Failed to parse <uses-sdk minSdkVersion='L'>: must be an integer number or codename.
[warn] [.../com.android.support-support-v4-21.0.0-rc1/AndroidManifest.xml:3] Failed to parse <uses-sdk targetSdkVersion='L'>: must be an integer number or codename.
[info] Performing full resource merge
java.lang.RuntimeException: Manifest merging failed. See console for more info.
        at com.android.builder.core.AndroidBuilder.doMerge(AndroidBuilder.java:920)
        at com.android.builder.core.AndroidBuilder.mergeLibraryManifests(AndroidBuilder.java:906)
        at com.android.builder.core.AndroidBuilder.processManifest(AndroidBuilder.java:612)
        at android.Tasks$$anonfun$58.apply(tasks.scala:912)
        at android.Tasks$$anonfun$58.apply(tasks.scala:899)
        at scala.Function9$$anonfun$tupled$1.apply(Function9.scala:35)
        at scala.Function9$$anonfun$tupled$1.apply(Function9.scala:34)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
        at sbt.std.Transform$$anon$4.work(System.scala:64)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
        at sbt.Execute.work(Execute.scala:244)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
[error] (android:processManifest) Manifest merging failed. See console for more info.

It seems like this library is pulling in the latest android support revisions.

Could it be that the "+" is causing it to do that?

dependencies {
compile 'com.android.support:appcompat-v7:+'
}

Please explain better how to use an custom view

Looks like custom views are pretty undocumented. Looks like the lib searches for specific IDs. And also it overrides the text on the "rate" button. Custom views are not useable this way

Multiple AppRates?

Is it possible to setup multiple AppRates? I would like to use one for a rating notification and one for social network notification but so far my efforts have failed...It seems that the last one declared overrides the oldest.

TransactionTooLargeException in Utils.isPowerOfTwo

My crash reporting site has just sent me a notification about the following exception:

Caused by android.os.TransactionTooLargeException
android.os.BinderProxy.transact (Binder.java)
android.app.ApplicationPackageManager.getPackageInfo (ApplicationPackageManager.java:70)
fr.nicolaspomepuy.discreetapprate.Utils.isPowerOfTwo
fr.nicolaspomepuy.discreetapprate.AppRate.with
pl.bartoszwesolowski.bloggerstats.BloggerActivity.onCreate
android.app.Activity.performCreate (Activity.java:4728)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1051)
...

The method itself (isPowerOfTwo) is just a one-liner and it looks ok. I'm not sure what might have caused this exception. Any ideas?

Use FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET when launching Play Store Intent

If the user presses the rate view and opens the Play Store app and then presses HOME and then opens the initial app, it shows the Play Store app instead of showing the last screen before going to Play Store. To fix this, we need to use FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + activity.getPackageName()))
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startaActivity(intent);

http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

Ad?

Hi.
I use your library and saw full ad banner. So, used in the library advertising?

Crash on click if no app installed which can handle "market://" intent

Steps to reproduce:

  1. Run in emulator or any other device which do not have Google Play installed.
  2. Call forceShow(). The apprate is shown.
  3. Press on AppRate to get a crash
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.myproject flg=0x10000000 }

Fix 1:
In forceShow() should be
if (!Utils.isGooglePlayInstalled(activity)) {
if (debug) LogD("Play Store is not installed. Won't do anything");
return;
}

instead of
if (!Utils.isGooglePlayInstalled(activity)) {
if (debug) LogD("Play Store is not installed. Won't do anything");
}

Fix 2:
Use try {} catch (Exception e) {} in onClick() while calling
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);

TransactionTooLargeException in "isGooglePlayInstalled"

I have lots of crash reports about "TransactionTooLargeException" in the method isGooglePlayInstalled.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.goseet.VidTrim/com.goseet.VidTrim.VideoDetails}: java.lang.RuntimeException: Package manager has died
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
       at android.app.ActivityThread.access$700(ActivityThread.java:150)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5283)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.RuntimeException: Package manager has died
       at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:99)
       at fr.nicolaspomepuy.discreetapprate.Utils.isGooglePlayInstalled(Utils.java:69)
       at fr.nicolaspomepuy.discreetapprate.AppRate.checkAndShow(AppRate.java:294)
       at com.goseet.VidTrim.VideoDetails.setupActivity(VideoDetails.java:168)
       at com.goseet.VidTrim.VideoDetails.onCreate(VideoDetails.java:73)
       at android.app.Activity.performCreate(Activity.java:5283)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
       at android.app.ActivityThread.access$700(ActivityThread.java:150)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5283)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: android.os.TransactionTooLargeException
       at android.os.BinderProxy.transact(Binder.java)
       at android.content.pm.IPackageManager$Stub$Proxy.getPackageInfo(IPackageManager.java:1612)
       at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:94)
       at fr.nicolaspomepuy.discreetapprate.Utils.isGooglePlayInstalled(Utils.java:69)
       at fr.nicolaspomepuy.discreetapprate.AppRate.checkAndShow(AppRate.java:294)
       at com.goseet.VidTrim.VideoDetails.setupActivity(VideoDetails.java:168)
       at com.goseet.VidTrim.VideoDetails.onCreate(VideoDetails.java:73)
       at android.app.Activity.performCreate(Activity.java:5283)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
       at android.app.ActivityThread.access$700(ActivityThread.java:150)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5283)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
       at dalvik.system.NativeStart.main(NativeStart.java)

Not compatible with Android 2.2 and below.

The library uses reflection to get "firstInstallTime" (PackageInfo) which is available for API 9 and above. However for API 8 and below AppRate will generate NullPointerException on calling checkAndShow() method.

// AppRate.java
Date installDate = Utils.installTimeFromPackageManager(activity.getPackageManager(), activity.getPackageName());
Date now = new Date();
if (now.getTime() - installDate.getTime() < installedSince * 1000) { // <<<<<<<<<< NullPointerException for Android 2.2 and below!!!!

// Utils.java
public static Date installTimeFromPackageManager(
PackageManager packageManager, String packageName) {
....
// field wasn't found
return null;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.