Vijay Samuel's Blog

Archive for January 2015

With Push Notification contribution that is available, implementing push notifications was very simple and straightforward. A big thanks to the contributor.

  • To get push notifications working on Android, one needs to set up Google Cloud Messaging. Google has this well documented and the steps can be found here.
  • Once GCM has been set up, goto your Drupal website and install push_notifications and drupalgap_mobile_notifications plugins. Enable them after installation. Once you have enabled the plugins, goto the permissions of push_notifications and adjust the permissions of creating and removing device tokens as per your application needs. In my case, I wanted tokens to be created even for anonymous users so I had granted permissions for the same and had made the required changes in the drupalgap push_notifications module. Also place the GCM_SENDER_ID that was generated while setting up GCM in the variable defined in push_notifications.js right at the top.
  • After that, goto Administration -> Structure -> Services -> Drupalgap and enable the push notifications checkbox to make the REST endpoint live.
  • Goto Configuration -> Push Notifications -> Configuration to setup the push notifications module. In the bottom provide the API key that was generated in your GCM developer console and save the configuration.
  • Now we’re all set in the Drupal end to send notifications. Setting up the Drupalgap end is very straight forward. Download the push_notifications module and place it in the apps/modules/custom/push_notifications directory.
  • Add an entry to the settings.js to register the custom module.
  • Once this is done, launch the app to make sure that the device token gets registered with the Drupal push_notifications module. It can be verified by going to Configuration -> Push Notifications -> Overview which shows the number of device tokens registered per platform.
  • When you’ve verified that there are registered tokens, click on the Send Push tab to compose a Push message and send it across.

Hope this helps. Happy pushing! Cheers! 🙂

More insights on my ventures in to app development using Drupalgap. I had received a lot of complaints from users that there is considerable flickering in the mobile app that I had built. The flickering wasn’t very much visible in Kit Kat devices but as I went down API levels it was very much visible. The solve was a two part problem:

1) Drupalgap uses the ‘Fade’ transition to move from one page to another. By changing the transition from fade to ‘Slide’ the transitions became much smoother than it was earlier. Sample code on how to change the transition can be seen here.

2) ICS and lower versions of Android seem to have the flickering issue even after the transitions change was implemented. That got fixed when I disabled hardware acceleration. To disable it just goto the AndroidManifest.xml and change the values of hardwareAcceleration to false.

This did the trick. Hope this helps!

Cheers!! 🙂

I’ve been playing around with Drupalgap for a while now and have been very impressed with the contribution done by Tyler Frankenstein. One problem that I had run into is, when doing cross platform testing, Android 4.0.* was throwing a white screen of death. There were multiple solutions out there and experimenting with each one was a pain. I’ve finally solved the issue and here is how I got about it.

Turns out that corodova-android-3.7.0 has the fix to the white screen of death and it can be used as the cordova.js to build the target app for Android.

Follow the instructions in the below link to generate the 3.7.0 version of cordova.js:

The resultant cordova.js can be found in the source cordova-js directory under pkg/ Copy that file into platforms/android/platform_www/cordova.js and rebuild your cordova app. It should fix the issue.

Hope this helps. Cheers! 🙂

My Timeline

January 2015
« Sep    

I, Me and Myself

My Blog Stats

  • 6,257 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 4 other followers