Agasper / unity-android-notifications

Unity3D Plugin for Android local notifications with example project
Other
555 stars 184 forks source link

Notification not showing if app not running #86

Open jax297 opened 6 years ago

jax297 commented 6 years ago

Hey, is there a way to show the notification even if app is not running?

vietdungdev commented 6 years ago

did you mean Hide notification while unity activity is visible

public boolean isForeground(){

        Activity currentActivity = UnityPlayer.currentActivity;
        // If not then our app is not on the foreground.
        return currentActivity != null && currentActivity.hasWindowFocus();
    }

and

   public void onReceive(Context context, Intent intent)
    {
        Boolean notifyOnForeground = intent.getBooleanExtra("notifyOnForeground",true);
        if(notifyOnForeground == false && isForeground()) return;
     //other code
   }
jax297 commented 6 years ago

@DungDajHjep Sory, no, what I meant was:

Agasper commented 6 years ago

Can't reproduce. Please provide ADB logs and reopen issue if it appears after update

lhs77074232 commented 5 years ago

@Agasper

  1. open test application
  2. modify function OneTime In NotificationTest.cs -> LocalNotification.SendNotification( 1, 50000, "Title", "Long message text", new Color32( 0xff, 0x44, 0x44, 255 ) );
  3. click onetime 5 sec button 4.close app

it will apper

lhs77074232 commented 5 years ago

test.log @Agasper this is the log

iRDS commented 5 years ago

Any news on this? I'm having the same issue on Android Oreo 8.0 if you make the app go to background the notifications works just fine, but if you force close the app, the notifications wont be shown

littlelittlefox commented 5 years ago

Any ideas? I have the same problem now