Using 10.8 Notification Center in Java - java

this is just a general question. I'm not having an actual project or something else where I want to do this.
Is it possible to build an App in Java and add some framework stuff or something else and use Notication Center?

I wrote a simple C -> Objective-C shim .dylib that exported a function showNotification That delivered a notification immediately.
Then I wrote a JNA wrapper to the function exported in the dylib. I'm sure that you could use a combination of Rococoa and JNAerator to eliminate this dylib altogether.
Then I wrote a simple java application that I turned into an app bundle. This is the important point. If your java application is not in an app bundle then notifications will not be delivered.
Messages delivered to the notification center.
It's eminently doable, you just have to play along with the rules of the NSUserNotificationCenter - it must be in an app bundle.
I used java 7, update 9 for this. Another question seems to have had even more success.
The code used to build this simple application is available on github. It contains an xcode project for creating the .dylib, and a netbeans project that makes use of the .dylib to deliver notifications.

I' ve found a solution that might work for you, you can use Apple script to show notifications on osx, try this:
Runtime.getRuntime().exec(new String[] { "osascript", "-e", "display notification "This is a message" with title "Title" subtitle "Subtitle" sound name "Funk"" });
You can read about Apple script's notifications in here

One possible solution will be Growl when the App will be updated to Growl 2.0 which will forward Growl Notifications to the Notification Center.
Informations about Growl 2
Growl Messages can be forwarded with the current Versions by using MoutainGrowl
Growl can be used under Java with libgrowl or jgntp
Maybe it's not the cleanest solution and it has some requirements to the user but it's definitely one that works

I suggest you take a look at how IntelliJ IDEA handles notifications in MountainLionNotifications and GrowlNotifications.
As suggested in other answers, it uses JNA to manipulate NSObjects.

Related

Remove android setting screen from recent list [duplicate]

I was wondering if anyone had a relatively simple solution for us.
We created an app to be used by our clients on android devices that we give them.
We would like the client to only be able to use our app and have limited access to everything else (i.e. settings, email etc.) What is the best way to achieve this without using 3rd party apps.
Thank you in advance!
This may not help but the L preview has a task locking feature included that may be of some insight, I'm not aware of how it functions as yet
Task locking
The L Developer Preview introduces a new task locking API that lets you temporarily restrict users from leaving your app or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android. Once your app activates this mode, users will not be able to see notifications, access other apps, or return to the Home screen, until your app exits the mode.
http://developer.android.com/preview/api-overview.html
Hope this helped
Suppress the Title Bar & Make Your App a Launcher
Root Your Tablet
Modify System Files and Settings to hide the soft keys
On the next link you can find the complete solution for the Nexus 7 (2012)
http://thebitplague.wordpress.com/2013/04/05/kiosk-mode-on-the-nexus-7/
simple Answer is:
Lock Install button with modify system settings.
Create your own customized-ROM and apply your requirement to that ROM.
more info, visit XDADavelopers

What is the right way to add Java code to a Cordova Android app?

I am working on an Cordova Android app. As part of the app, I wrote some Java classes to create a service using WorkManager to poll our server and send a notification to the client on certain events.
Right now the code is invoked through MainActivity.java, where I create the worker, and all of the classes sit in the Java folder under the Android Platform directory. My understanding is that this isn't ideal since my code will get dropped every time we want to reset the platform.
What is the right way to add this code to a project and is there a tutorial that I can follow? Should it all be a plugin?
Thank you in advance.
You should definitely refactor your code into a plugin. Check out the doc here
You can make your plugin for Android only as well.
I would recommend too, to clone a very simple plugin and check out the code.

Raspberry Pi, java, SPI and Touchscreens

I´m intending to build some java apps to be run on a raspberry pi, the main thing is that I intend them to be used with a touchscreen (not too expensive of course)
I´ve been reading about SPI communication an GPIO also, but I still have some doubts.
Can I use the SPI ports and the GPIO to both control and connect the touchscreen to the board?
in this case, Is "everything included" on raspbian? (Let me explain that) if you use the standard HDMI, my JVM will interact with raspbian to control the screen (as a standard computer screen) and the same with the touch events coming from the USB. But, as I´m not using these ports, Will I need any special libraries to be installed on raspbian? and of course, Are any?
The main problem is that I've found some libraries on c (for certain screens) but I will like to use java. If not, I will try to implement any kind of "system calls-like" interface with both java for the apps and c for the events and screen drawing.
Does all the things that I´m typing make sense?
Thanks a lot. I will appreciate any help.
yes your RaspberryPi can work with touch-screens, use JavaFX/OpenJFX. Note - you will need a compatible touch screen device (some of which are listed in the link below)
See: https://wiki.openjdk.java.net/display/OpenJFX/OpenJFX+on+the+Raspberry+Pi
There are numerous articles which explain how to handle touch events with JavaFX/OpenJFX so hopefully using the API wont be too much of a problem.
Hope that helps :)

"One App" Android System

I created an Android app which communicates via USART with a µC in order to evaluate data. My co-workers and customers should use the tablet for only this purpose now. Is there any possibility to "hide" the Android OS or making it inaccessible?
Devices are rooted and I am willing to build custom ROMs (even though I do not have any experience with that yet). Are there any approaches available that I do not have to start from scratch?
Many thanks for your help.
Well. That what I'm trying to do !
The first thing I tried was to start the app just after the boot of the device (Quite easy with this).
Then, I get Android source code, and I hide the bottom bar using this code
The problem is, if your application is not stable ... you'll have some problem.
If you want to modify Android source code, the developper doc contains a very good tutorial to start !

Getting text-to-speech working and connecting it to java

Ok so I have an artificial intelligence system running on my Mac through terminal, on localhost with java. I want to make my ai speak without flash. There is an HTML tag that could be easily plugged into a tts script, but I don't want to output an mp3 file, I want to output an audio tag with autoplay and hidden so that it seems every time you get a response from the ai, it will speak too.
Google translate TTS implemented as a servlet would solve this problem, I think. See this implementation. That is of course if you don't mind installing Tomcat or equivalent.
The problem is, until when will Google Translate TTS be free?
Do you know about the JavaSpeech API and, for example, the FreeTTS implementation?

Categories

Resources