Jonathan Pitre
Jonathan Pitre

Reputation: 2425

Android - Launch notification from anywhere?

I'm coding on the android right now, and I have an Activity which starts and stops a Service. However, related to this whole application will be a non-android java application which runs in the background alongside this app. I need this separate activity to be able to launch a notification, but I don't know how to do this. I cannot create a static method in either my Activity or my Service since then I wouldn't be able to get the context. Is there a way to do this?

Thanks! NS

Upvotes: 0

Views: 597

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007494

...a non-android java application which runs in the background alongside this app

Ummm...there is no real support in Android for "a non-android java application".

I need this separate activity to be able to launch a notification, but I don't know how to do this.

If it is an Activity, just use NotificationManager -- Activity is a Context.

If it is "a non-android java application", rewrite it such that it is an Activity or Service.

Upvotes: 1

Related Questions