Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Gideros Notification Plugin — Gideros Forum

Gideros Notification Plugin

ar2rsawseenar2rsawseen Maintainer
edited April 2013 in General questions
Just commited notification plugin to github:
https://github.com/ar2rsawseen/GiderosNotificationPlugin

It contains all needed files for Android and IOS plugin and Test Gideros project.

Temporary documentation: http://appcodingeasy.com/new_docs/index.html
Android installation instructions: https://github.com/ar2rsawseen/GiderosNotificationPlugin/tree/master/AndroidPlugin
IOS installation instructions: https://github.com/ar2rsawseen/GiderosNotificationPlugin/tree/master/IOSPlugin
Happy 1st of April guys ;)
+1 -1 (+2 / -0 )Share on Facebook
«1345

Comments

  • NascodeNascode Guru
    edited March 2013
    @ar2rsawseen awesome, Thanks for the plugin!

    ps: i Love the new docs interface :D
    have fun with our games~
    http://www.nightspade.com
  • @ar2rsawseen thanks so much. =D> ^:)^

    If you will also one day make google map plugin Gideros will have everything that i needed from it for my new project :D

  • ar2rsawseenar2rsawseen Maintainer
    By the way, there was also a Microphone plugin available somewhere for some time, wonder why no one uses it :)

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • You might want to update the readme.md file on the https://github.com/ar2rsawseen/GiderosNotificationPlugin/tree/master/IOSPlugin link, as it reads as per the attachde screenshot and that would be a bit confusing.
    Screen Shot 2013-04-01 at 8.52.24 PM.png
    328 x 274 - 24K
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • ar2rsawseenar2rsawseen Maintainer
    edited April 2013
    :)) :))
    Copy pasting
    Can we write it off to a practical joke on 1st of April? :D
  • amaximovamaximov Member
    edited April 2013
    Edit: Now working! Silly me forgot to add some jni files :)
    Edit 2: App only works if it is run on phone through Eclispe(run -> choose devices connected by adb). The app still "crashes" if I do a regular packaging of the app. Do I have to use a key other than the default debug key?
  • ar2rsawseenar2rsawseen Maintainer
    Hello @amaximov ;)

    I think you should have been able to use so files without jni source (without compiling your own so files)

    And about what debug key are you talking?
  • Thanks for this, great stuff. :)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • When you compile eclipse by default uses the debug android key to sign the app. Il keep working on it later today. Is this plugin going to be packaged with the next release of Gideros?
  • ar2rsawseenar2rsawseen Maintainer
    @amaximov if no serious bugs reported, probably yes :)

    So you want to say that all works when you run app from eclipse, but not when you export the app?
  • amaximovamaximov Member
    edited April 2013
    Hey @ar2rsawseen now the app crashes no matter how I install it. It looks like the NotificationManager class is not available even though I do system.loadLibrary("notification"); and add it to external classes like :"com.giderosmobile.android.plugins.notification.NotificationClass" I have attached a log filtered to read only my app package debug info.

    For the debug file, the "PushNotificationController" is just a lua file I have that controls all notifications. I have attached is as PushNotificationController.txt. Feel free to just make it a .lua to examine where the error occurs.
    txt
    txt
    log.txt
    6K
    txt
    txt
    PushNotificationController.txt
    889B
  • And I have obviously added intent handling, modified android manifest, added .so libs, added gcm.jar, and added proper build path.
  • Oh goodness, I thought Notification would be globally as soon as the app launched and guess what, I forgot to call a simple "require("notification")"! Great lib @ar2rsawseen look forward to using it!
  • ar2rsawseenar2rsawseen Maintainer
    @amaximov I'm just glad that resolved. ;)

    Probably need to state that somewhere in the docs, about requiring :)
  • SinisterSoftSinisterSoft Maintainer
    edited April 2013
    @ar2rsawseen I use the microphone plugin, works great - and will be better when the enhancements are added (discussed in the microphone thread: http://www.giderosmobile.com/forum/discussion/3008/audio-capture#Item_11 )
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • Awesome! Thanks @ar2rsawseen!
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • krisiskrisis Member
    @ar2rawseen - need to update docs, they show:
    NotificationManager Event.LOCAL_NOTIFICATION
    NotificationManager Event.PUSH_NOTIFICATION
    NotificationManager Event.PUSH_REGISTRATION
    NotificationManager Event.PUSH_REGISTRATION_ERROR

    There should be an ON_ prefixing all those. Text also needs to be updated in the code examples for each of those doc sections.
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • krisiskrisis Member
    I also get a crash when closing the game:

    NotificationClass.mm line 44
    +[NotificationClass deinitialize]
    [notifics removeAllObjects];
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • ar2rsawseenar2rsawseen Maintainer
    @krisis yes you are right, but it was supposed to be without ON_ I will fix that, and let me take a look at the crash issue
  • ar2rsawseenar2rsawseen Maintainer
    Hello,
    I've updated the repo, renamed events correctly for consistency (removed ON_) for both IOS and Android, and also changed example Gideros project.

    About the crash you were, having, well I haven't experienced anything like that, but that specific call, actually was not required, all the contents being released in previous loop and object being auto released, thus I just removed it. :)

    Let me know if that works now ;)
  • krisiskrisis Member
    @ar2rsawseen - yeh, I had commented it out after seeing that loop too and it didn't crash after that.
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • Hi @ar2rsawseen,

    Im trying to plug in the Notification stuff.
    i thought i had it all in place.
    Exported to Eclipse, but when i attempt to run this bit:
    I get the error below in Eclipse. "global 'Notification' (a nil value)"
    One thing im not sure about, in the Starting Activity, if there are more than one External, is this the syntax, with the commas ?
     
    	static
    	{
    		System.loadLibrary("gideros");
    		System.loadLibrary("luasocket");
    		System.loadLibrary("lfs");
    		System.loadLibrary("ggooglebilling");
    		System.loadLibrary("lsqlite3");
    		System.loadLibrary("notification");
    	}
     
    	static private String[] externalClasses = {
    		"com.giderosmobile.android.plugins.googlebilling.GGoogleBilling",
    		"com.giderosmobile.android.plugins.notification.NotificationClass",
    	};

    ---------------------------
     
    07-14 13:23:02.248: D/Gideros(13811): *CppLuaBridge::luaEvent* stack NOT ok begin:3 end:6 delta:0
    07-14 13:23:02.248: D/Gideros(13811): *EventDispatcherBinder::dispatchEvent* stack NOT ok begin:2 end:6 delta:0
    07-14 13:23:02.248: D/Gideros(13811): *visit(MouseEvent* v)* stack NOT ok begin:0 end:6 delta:0
    07-14 13:23:02.248: D/Gideros(13811): *CppLuaBridge::luaEvent* stack NOT ok begin:0 end:6 delta:0
    07-14 13:23:02.248: D/Gideros(13811): *enterFrame* stack NOT ok begin:0 end:6 delta:0
    07-14 13:23:02.248: D/Gideros(13811): C:/Gideros_Development/Deployments/Bubble-Adventure-Colors/assets/assets/level_select.lua.jet:186: attempt to index global 'Notification' (a nil value)
    07-14 13:23:02.248: D/Gideros(13811): stack traceback:
    07-14 13:23:02.248: D/Gideros(13811): 	C:/Gideros_Development/Deployments/Bubble-Adventure-Colors/assets/assets/level_select.lua.jet:186: in function <C:/Gideros_Development/Deployments/Bubble-Adventure-Colors/assets/assets/level_select.lua.jet:182>
    07-14 13:23:02.248: D/Gideros(13811): 	C:/Gideros_Development/Deployments/Bubble-Adventure-Colors/assets/assets/classes/button.lua.jet:50: in function <C:/Gideros_Development/Deployments/Bubble-Adventure-Colors/assets/assets/classes/button.lua.jet:46>
    07-14 13:23:02.278: D/MediaPlayer(13811): pause() in
    07-14 13:23:02.278: D/MediaPlayer(13811): pause() out
    07-14 13:23:02.769: D/MediaPlayer(13811): stop() in
    07-14 13:23:02.779: D/MediaPlayer(13811): stop() out
    07-14 13:23:02.779: D/MediaPlayer(13811): release() in
    07-14 13:23:02.789: D/MediaPlayer(13811): release() out
    07-14 13:23:02.799: E/libEGL(13811): call to OpenGL ES API with no current context (logged once per thread)
    07-14 13:23:02.919: D/WindowManagerImpl(13811): finishRemoveViewLocked, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView@4052b010
  • @ar2rsawseen,

    Sussed it !
    Maybe add this somewhere in the documentation.

    i added this to my main.lua.
    require "notification"

    BUT!.
    it creates a notification on my phone, which opens the game, which is great. but i really wanted like an android "toast" command, so i can inform the user, of a payment accepted etc

    is there such a thing ?



  • ar2rsawseenar2rsawseen Maintainer
    edited July 2013
    @ArtLeeApps yes well every plugin needs to be required thus I thought it's understandable :-\" :D

    About toast notifications, well it's not possible, not currently, notification managing was standardized to match both IOS and Android and since IOS does not have toast notification, I would suggest using something from Gideros itself, like AlertDialog or your own implementation, for example like used here:
    http://www.giderosmobile.com/forum/discussion/3147/achievements#Item_1

    But if you want, you can change a plugin code a bit to launch toast instead of notification when dispatching event now (without delaying).
    In NotificationClass.java find function public static void dispatchNow(int id)
    And change it to something like:
    public static void dispatchNow(int id){
    	if(mBuilders.get(id) != null)
    	{
     
    		GNotification mBuilder = mBuilders.get(id);
    		// set text to show
    		final String text = mBuilder.message;
    		//set duration of toast
    		final int duration = Toast.LENGTH_SHORT;
    		sActivity.get().runOnUiThread(new Runnable() {
    		            public void run() {
    			//create toast object
    			Toast toast = Toast.makeText(sActivity.get(), text, duration);
    			//show it
    			toast.show();
    			}
    	    	});
     
    	}
    }
  • @ar2rsawseen,

    thank you. So i suppose i should do a dialog, that way if i create a ios version, they will work in a similar way. Even though i still like toast :-)
  • larflarf Member
    edited September 2013
    I'm not sure why but I can't get local notifications to repeat. Maybe i'm not understanding the usage.

    I used the notification example project and simply added second table for one of the notifications.

    note:dispatchAfter({sec = 5}, {sec = 10})

  • @larf, let me retest it, do you use Android or IOS paltform?
  • @ar2rsawseen, I tried both. no luck.
  • @ar2rsawseen,
    Thank you for creating the plugins!

    I have a question about NotificationManager:getPushNotifications and clearPushNotifications.

    getPushNotifications docs say: "You must provide an ID on the server to identify your push notification in this list."

    Does that mean you will get push notifications from other apps here and somehow I have to go thought them and see if some are for my app?

    clearPushNotifications docs say: "Clears the data about received push notifications that can be retrieved using NotificationManager:getPushNotifications method."

    Do I have to call this method once I have read the notifications?
    What exactly will it do?

    Thanks

    Vlad
Sign In or Register to comment.