0

I would like to send a welcome message notification to apps installed from the Play Store.

Example :

Thanx for installing this app and share it with your friends, if you like more rate my android app.

Is it possible to do this?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Anto Navis
  • 31
  • 10
  • 1
    you cannot push a notification while install app from play store. For any action you need to open app at-least once. – AmmY Aug 31 '16 at 19:36
  • Thank you Ammy , how to send daily reminder about rate my app option while open my android app, it's possible to do it ?? – Anto Navis Aug 31 '16 at 20:12
  • You can write your rate class like this : http://stackoverflow.com/questions/14514579/how-to-implement-rate-it-feature-in-android-app or use libraries like https://github.com/hotchemi/Android-Rate. Whatever suits your need and style. – sumandas Aug 31 '16 at 20:46
  • There is many way to do this. 1. Show popup and save time of showing popup to SharePrefrences. 2. Add AlarmManager to show Reminder to Rate app. – AmmY Sep 11 '16 at 19:57
  • Can you attach the code for show popup to share prefrences and akso how to add alarm manager to show reminder to rate app – Anto Navis Sep 12 '16 at 07:01
  • Beware of unintended consequences, like one-star ratings from users who consider this type of notification to be unwanted spam. – arp Jan 25 '20 at 16:34

2 Answers2

0

you could possibly do something like this to know the app install event

In the manifest file:

<receiver android:name=".YourReceiver">
    <intent-filter>
        <action android:name="android.intent.action.PACKAGE_INSTALL" />
        <action android:name="android.intent.action.PACKAGE_ADDED" />
        <data android:scheme="package"/>
    </intent-filter>
</receiver>

In the java code

IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
intentFilter.addAction(Intent.ACTION_PACKAGE_INSTALL);
intentFilter.addDataScheme("package");
registerReceiver(br, intentFilter);
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Ashish Kumar
  • 374
  • 4
  • 11
0
private void checkVisit() {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    SharedPreferences.Editor editor = sharedPreferences.edit();
    int numberVisits = sharedPreferences.getInt(NUMBER_VISITS, 0);
    if(numberVisits >= 10){
        boolean notificationSent = sharedPreferences.getBoolean(NOTIFICATION_SHOWN, false);
        if(!notificationSent) {
            sendNotification();
            editor.putBoolean(NOTIFICATION_SHOWN, true);
        }
    } else{
        editor.putInt(NUMBER_VISITS, ++numberVisits);
    }
    editor.apply();
}

private void sendNotification() {
    Bitmap icon = BitmapFactory.decodeResource(getResources(),
            R.mipmap.ic_launcher);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setContentTitle("Thanks for downloading !")
            .setContentText("If you liked the app, please rate us")
            .setSmallIcon(R.mipmap.ic_launcher)
            .setLargeIcon(icon)
            .setStyle(new NotificationCompat.BigTextStyle()
                    .bigText("If you liked the app, please rate us"))
            .setContentIntent(PendingIntent.getActivity(this, 0, new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + "YOUR PACKAGE NAME GOES HERE"))
                    , 0))
            .setAutoCancel(true);
    NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(0, builder.build());
}

Call checkVisit onCreate in MainActivity, this will fire a notification on his 10th visit. When the user clicks the notification it will take him to the store directly to your app where he can rate it

Roudi
  • 1,249
  • 2
  • 12
  • 26
  • Can you send me the sample image for how to notification will showned on the android app ?? – Anto Navis Aug 31 '16 at 20:13
  • It's a normal push notification you get just like when you receive a whatsapp notification, facbeook, etc.... and when you click on it it will open play store to your app directly – Roudi Aug 31 '16 at 20:22
  • Context. its shows the error in context how to solve it ? – Anto Navis Sep 01 '16 at 18:58