Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Easy Cross-Platform Notifications available now!

Discussion in 'Assets and Asset Store' started by CarlosFM, Jun 8, 2013.

  1. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Well, I have already figured out what was going wrong.

    1) `'price'` is hardcoded to GCMJava.jar and to php-script, and I was actually storing message in the record with another key. Why 'price', not 'message', 'text', or smth like that?

    2) Root activity was not `UnityPlayerActivity` as hardcoded in GCMIntentService class, but rather `com.prime31.UnityPlayerNativeActivity` (i.e. overridden by plugin).
     
  2. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi,

    I believe I've answered your queries on the email you sent. Was that you? ;P
     
  3. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Yes, it was me. Thank you for reply!
     
  4. tonyhk123

    tonyhk123

    Joined:
    Aug 13, 2014
    Posts:
    1
    i would like to know what i need to do if i want to use ecpn and prime31 mutually
     
  5. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @tonyhk123: the plugin is perfectly compatible with any others -I assume you specifically mention prime31 because a number of their plugins extend the UnityPlayerActivity.

    Good (mostly) and bad news: ECPN does not need to extend that activity so there is no incompatibility with any other package. The -tiny- bad news is that until we release the new version -which will happen relatively soon- if your app extends the UnityPlayerActivity you must modify a little bit of the code that comes with ECPN. The change is not massive and it publicly available, so no biggie!

    If you decide to go for the plugin and your plugin does extend the main activity (i.e. in your manifest there is an activity with the MAIN and LAUNCHER tags), then you should do the following:

    - Open the GCMIntentService.java file that comes with the plugin
    - Go to the generateNotification() method
    - Remove the following lines:


    Intent notificationIntent = new Intent(GCMIntentService.this, UnityPlayerActivity.class);
    // set intent so it does not start a new activity
    notificationIntent.setFlags(
    Intent.FLAG_ACTIVITY_CLEAR_TOP |
    Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent =
    PendingIntent.getActivity(context, 0, notificationIntent, 0);- In its place, paste the following:

    1. Class<?> c = null;
    2. try {
    3. c = Class.forName("NAME_OF_YOUR_CLASS");
    4. } catch (ClassNotFoundException e) {
    5. e.printStackTrace();
    6. }
    7. Intent notiicationIntent = new Intent(context,c);
    8. notiicationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
      Intent.FLAG_ACTIVITY_SINGLE_TOP);
    9. PendingIntent intent =PendingIntent.getActivity(context, id, notiicationIntent, 0);
    Where "NAME_OF_YOUR_CLASS" you shoud put the name of your main activity

    Cheers
     
  6. sorushe-mehre

    sorushe-mehre

    Joined:
    Aug 12, 2013
    Posts:
    8
    Hi
    As you know, Android does not show full text of long "push notification" message in notification center.
    So i want to show complete message text in popup dialog in unity.
    How can i get complete message text in unity app when user click on notification?
     
  7. Manu_Gupta

    Manu_Gupta

    Joined:
    Jun 18, 2014
    Posts:
    3
    Hi Carlos,
    I have purchased your Easy Cross-Platform Notifications SDK from unity assets store and when i implemented this according to your guide i did not receive GCM registration ID on my android mobile device.
    On the another hand i used kskkbys/ unity-gam https://github.com/kskkbys/unity-gcm/wiki/Developer-Guide
    and its working fine .
    Can you please suggest me the solution. I will be highly obliged.(My mail Id is manu.xeemu@gmail.com )
    Thanks...
     
  8. sorushe-mehre

    sorushe-mehre

    Joined:
    Aug 12, 2013
    Posts:
    8
    I am waiting for 12 days and got no support from plugin developer.
    What kind of support is it?
    I will continue posting on this forum to explain other customers how poor is quality of CarlosFM`s services.
     
    smith_jack likes this.
  9. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
  10. sorushe-mehre

    sorushe-mehre

    Joined:
    Aug 12, 2013
    Posts:
    8
    I've emailed some problem , but got no answer from him
     
  11. EnriqueL

    EnriqueL

    Joined:
    Sep 10, 2014
    Posts:
    2
    Hi Carlos, I've send you an Email.
    I've have a problem in Ios, i can send the notification, but I can't erase them, even if I uninstall the app an re install the old notification are there, how can i solve this??

    Thank you so much!
     
  12. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @sorushe.mehre: I don't get notifications from Unity Forums, so your best bet is to send me an email -which I always respond to. I apologise if you did not get a response from me, I assure I take great pride on supporting developers, maybe the email got blocked, not sure. As per your question, not sure what exactly is the functionality you are asking for. At the moment, you cannot show the message received on the notification once you enter the application -not sure why you would need such a use case. But if you want, you can explore the possibility of sending messages to the app right after opening it -you could tinker with the Java code as the package offers it for people that want custom behaviour.

    @EnriqueL: Yeah, I was just typing my response :) That does sound odd! So the notification is not clearing from the tray even if you hit "clear" button or if you tap on it? Please note that the plugin does not deal with the presentation of the notification itself -this is handled half Unity NotificationService class and half Apple servers. Once thing you can do when you open your app is check if there are any notifications on the tray and clear them -see Unity documentation for more info.

    Once again, apologies to all users that feel we do not offer the support they deserve. As mentioned above, sending emails is the safest bet if you want a rapid response, but please do post here if you don't get a reply, as it may very well be that I'm not receiving your mail.

    Cheers
     
  13. jrobison

    jrobison

    Joined:
    Mar 4, 2014
    Posts:
    2
    For anybody wanting to recompile from the command-line, here are the quick steps.

    1. Unzip the GCMJava.jar file into a directory of your choosing and cd into that directory.
    2. Copy the earliest version of the android sdk ( I believe I used API 14 for mine ) your project requires into the folder you unzipped the jar into.
    3. Make sure an early version of java 7 ( seems to work for me ) or a version of java 6 is in your PATH. On my MAC I used the following commands:
      • export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home";
      • export PATH=$JAVA_HOME/bin:$PATH;
      • sudo ln -snf /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
    4. After you've renamed the folders and package names in the java files, run the following ( where com/company/packagename is your actual directory structure ):
      • javac -classpath classes.jar:gcm.jar:android.jar:. com/company/packagename/*.java.
    5. Add the following lines to META-INF/MANIFEST.MF:
      • Manifest-Version: 1.0
      • Class-Path: android.jar gcm.jar classes.jar
    6. Now run this to build the jar file:
      • jar cvmf META-INF/MANIFEST.MF GCMJava.jar com
    7. And finally, copy the jar file to your Assets/Plugins/Android folder.

    Please let me know if you have any problems with this. I'm sure I missed something in there, but I'll gladly help troubleshoot if anyone finds an issue with it.

    Hope this helps someone.
     
  14. teophilik

    teophilik

    Joined:
    Feb 13, 2013
    Posts:
    11
    Hello Carlos!
    I have the following issue

    Unable to convert classes into dex format. See the Console for details.
    C:\Program Files\Java\jdk1.8.0_31\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/android-sdk-windows\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

    I am wondering what compiler did you use to create the .jar file. It works very well if i let the GCMJava file that is provided in the original plugin. It used to work before with EclipseCompiler 0.A48 but now it is not working anymore. I mention that lately I installed Unity5 and my android-sdk-windows was updated. Still, the GCMJava file in the original is working, so I would like to know the exact compiler that you used to compile the .jar file. Thanks
     
  15. alvachristi

    alvachristi

    Joined:
    Oct 7, 2014
    Posts:
    2
    This looks like exactly the solution I was looking for my projects, but having one question. Is it possible to have custom notification icons?If you not having this so is there any chances to implement it in future?
     
  16. teophilik

    teophilik

    Joined:
    Feb 13, 2013
    Posts:
    11
    does anybody else have problems with the plugin in unity5?

    it keeps returning me dex errors
     
  17. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    You can try using this asset instead. It's optimised for the Unity5 (and also supports the Amazon Android devices).
     
  18. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @teophilik : the plugin should not have problems with Unity 5. DEX errors are normally linked to a class being defined multiple times in a java jar package.

    In ECPN it is likely that during recompilation you have some of the old .class files still lingering within the jar, so what I would recommend is try to recompile the jar package again, but before doing so remove any class file from the folder where your .java files are (any $class too).

    That should do the trick
     
  19. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @alvarchristi: Yes, it is perfectly possible to define your own notification icon. At the moment you have to place your icon file in a specific folder within your Unity project and under a specific name and it will get picked up by the plugin.
     
  20. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    In addition to making sure you delete .class files before compiling the java package, make sure you do not have the android.jar package in the Unity project folder when you build your game -this file ships with the plugin as a convenience file to be able to recompile the java project, but it should not be included within your project folders; check if it is under Plugins/Android and if so, you can safely remove it.
     
  21. F-G

    F-G

    Joined:
    Apr 22, 2013
    Posts:
    2
    Hello Carlos!
    Thank you first for your nice plug-in, we used it now for more then a year and it fits perfectly into our project. Some days ago we found some strange behavior during testing our app on android:
    1. starting the app on an android device
    2. suspending the app by clicking the home button (the app is running in the background we don't want to close the app)
    3. forcing the system to send a push notification
    4. by clicking on the push notification the app comes back to the front but it is only a black
      screen.
    Please note that the behavior is correct if the app has to be freshly lunched by the system.
    Before I start to explain what I have checked so far some facts:
    • We using your plug-in version 1.04b at the moment, but I tried also your new version from August but the result was the same behavior.
    • Our project is still running on Unity 4.6.9f1.
    • We build the project with the android API Level 21 (which is required by the unity version)
    • Our test devices are:
      • Nexus 10 with android 5.0
      • Samsung Galaxy Tab with android 4.0.4
      • Galaxy S3 with android 4.3
    • We cann't close the app each time the user leaves the app with the home button!
    • Here is the out put of the android console:
      Code (CSharp):
      1. D/StatusBar(  517): Clicked on content of 0|com.my.appname|0|null|10147
      2. I/ActivityManager(  407): START u0 {flg=0x24000000 cmp=com.my.appname/com.unity3d.player.UnityPlayerActivity} from uid 10147 on display 0
      3. W/ActivityManager(  407): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { flg=0x24000000 cmp=com.my.appname/com.unity3d.player.UnityPlayerActivity }
      4. V/WindowManager(  407): addAppToken: AppWindowToken{27ecf8a token=Token{27bd35f5 ActivityRecord{1eb2d72c u0 com.my.appname/com.unity3d.player.UnityPlayerActivity t87}}} to stack=1 task=87 at 1
      5. W/ResourceType(29753): Invalid package identifier when getting bag for resource number 0x00000000
      6. V/WindowManager(  407): Adding window Window{c0c3a18 u0 com.my.appname/com.unity3d.player.UnityPlayerActivity} at 5 of 12 (after Window{1a4cfb75 u0 com.my.appname/com.androidnative.AndroidNativeBridge})
      7. V/WindowManager(  407): Adding window Window{13025a56 u0 SurfaceView} at 5 of 13 (before Window{c0c3a18 u0 com.my.appname/com.unity3d.player.UnityPlayerActivity})
      8. D/PhoneStatusBar(  517): disable: < expand icons* alerts system_info* back home recent clock search >
      9. D/mali_winsys(  517): new_window_surface returns 0x3000
      10. I/Keyboard.Facilitator(  725): onFinishInput()
      11. I/ActivityManager(  407): Displayed com.my.appname/com.unity3d.player.UnityPlayerActivity: +630ms
      12. E/WifiStateMachine(  407): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.85 rxSuccessRate=0.44 targetRoamBSSID=cc:b2:55:8d:0e:e0 RSSI=-54
      13. E/WifiStateMachine(  407): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=1.39 rxSuccessRate=0.70 targetRoamBSSID=cc:b2:55:8d:0e:e0 RSSI=-52
      14. E/WifiStateMachine(  407): WifiStateMachine starting scan for "XXXX"WPA_PSK with 2467,2437
      15. E/WifiStateMachine(  407): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=2.10 rxSuccessRate=1.55 targetRoamBSSID=cc:b2:55:8d:0e:e0 RSSI=-54
      16. E/WifiStateMachine(  407): WifiStateMachine starting scan for "XXXX"WPA_PSK with 2467,2437
      17. I/Keyboard.Facilitator.LanguageModelFlusher(  725): run()
      18. I/Keyboard.Facilitator(  725): flushDynamicLanguageModels()
      19. I/ConfigService(21990): onCreate
      20. I/ConfigService(21990): onDestroy
      To Compare this you can have a look on the out put of the android console during a freshly lunch of the app (in this case everything is working correctly):

      Code (CSharp):
      1. D/StatusBar(  517): Clicked on content of 0|com.my.appname|0|null|10147
      2. I/ActivityManager(  407): START u0 {flg=0x24000000 cmp=com.my.appname/com.unity3d.player.UnityPlayerActivity} from uid 10147 on display 0
      3. W/ActivityManager(  407): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { flg=0x24000000 cmp=com.my.appname/com.unity3d.player.UnityPlayerActivity }
      4. V/WindowManager(  407): addAppToken: AppWindowToken{3db9319b token=Token{a1481aa ActivityRecord{96fdc95 u0 com.my.appname/com.unity3d.player.UnityPlayerActivity t88}}} to stack=1 task=88 at 0
      5. V/WindowManager(  407): Adding window Window{32084750 u0 Starting com.my.appname} at 3 of 10 (after Window{f477671 u0 com.android.launcher/com.android.launcher2.Launcher})
      6. W/linker  (30396): libunity.so: unused DT entry: type 0x6ffffffe arg 0x1d074
      7. W/linker  (30396): libunity.so: unused DT entry: type 0x6fffffff arg 0x1
      8. D/PhoneStatusBar(  517): disable: < expand icons* alerts system_info* back home recent clock search >
      9. W/ResourceType(30396): Invalid package identifier when getting bag for resource number 0x00000000
      10. V/WindowManager(  407): Adding window Window{365db068 u0 com.my.appname/com.unity3d.player.UnityPlayerActivity} at 3 of 11 (before Window{32084750 u0 Starting com.my.appname})
      11. D/mali_winsys(  517): new_window_surface returns 0x3000
      12. V/WindowManager(  407): Adding window Window{2e380126 u0 SurfaceView} at 3 of 12 (before Window{365db068 u0 com.my.appname/com.unity3d.player.UnityPlayerActivity})
      13. I/ActivityManager(  407): Displayed com.my.appname/com.unity3d.player.UnityPlayerActivity: +736ms
      14. I/Keyboard.Facilitator(  725): onFinishInput()
      15. D/mali_winsys(30396): new_window_surface returns 0x3000
      16. D/Unity   (30396): GL_EXT_debug_marker GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_disjoint_timer_query GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context GL_OES_texture_stencil8 GL_EXT_shader_pixel_local_storage GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_AR
      17. D/Unity   (30396): M_mali_program_binary GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_KHR_blend_equation_advanced GL_OES_texture_storage_multisample_2d_array GL_OES_shader_image_atomic
      18. W/libc    (30396): pthread_create sched_setscheduler call failed: Operation not permitted
      19. D/mali_winsys(30396): new_window_surface returns 0x3000
      20. E/WifiStateMachine(  407): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=2.50 rxSuccessRate=0.42 targetRoamBSSID=cc:b2:55:8d:0e:e0 RSSI=-62
      21. E/WifiStateMachine(  407): WifiStateMachine starting scan for "XXXX"WPA_PSK with 2467,2437
      22. I/GCM     (21990): GCM message GSYNC_TICKLE 0:1450368223178936%e7a71353318775e5
      23. I/SubscribedFeeds( 4585): Received message
      24. W/Gmail   (30029): Sync started for account: account:-1171984186
      25. I/Gmail   (30029): notifyAccountChanged
      26. I/Gmail   (30029): getAccountsCursor
      27. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      28. I/Gmail   (30029): MainSyncRequestProto: lowestBkwdConvoId: 0, highestHandledServerOp: 306654, normalSync: true
      29. W/ResourcesManager(30029): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
      30. W/ResourcesManager(30029): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
      31. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      32. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      33. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      34. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      35. W/Herrevad(21990): mobile connection type with no cell id
      36. I/Gmail   (30029): MainSyncRequestProto: lowestBkwdConvoId: 0, highestHandledServerOp: 306690, normalSync: true
      37. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      38. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      39. W/Herrevad(21990): mobile connection type with no cell id
      40. I/Gmail   (30029): MainSyncRequestProto: lowestBkwdConvoId: 0, highestHandledServerOp: 306690, normalSync: true
      41. I/Gmail   (30029): lowestBackward conversation id 0
      42. I/Gmail   (30029): Sending provider changed intent: Intent { act=android.intent.action.PROVIDER_CHANGED dat=content://gmail-ls/unread/^i (has extras) }
      43. I/art     (  407): Explicit concurrent mark sweep GC freed 78322(3MB) AllocSpace objects, 6(2MB) LOS objects, 33% free, 29MB/44MB, paused 1.127ms total 82.889ms
      44. I/Gmail   (30029): notifyAccountChanged
      45. W/Gmail   (30029): Sync complete for account: account:-1171984186
      46. I/Gmail   (30029): getAccountsCursor
      47. V/GLSActivity(21990): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService }
      48. I/NotifUtils(30029): Validating Notification, mapSize: 1 getAttention: true ignoreUnobtrusive: false
      49. I/NotifUtils(30029): Unseen count doesn't match cursor count.  unseen: 3 cursor count: 1
      50. I/NotifUtils(30029): Showing notification with unreadCount of 2 and unseenCount of 1
    What I have done so far but the behaviour was still the same:
    • As written before I tested your new version from the asset store by integrating it into our App. Could be that I didn't import it correctly, but push notifications arrived on the devices.
    • I rewrote from your version 1.04b the Intent behaviour, with some other flags. In the File GCMIntentSercie.java I changed the Line notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); to some other. I tried this one:
        • Intent.FLAG_ACTIVITY_NEW_TASK

        • Intent.FLAG_ACTIVITY_MULTIPLE_TASK
    • I tried to change the Android Manifest, to set the android:launchMode="singleTask" for the activity "com.unity3d.player.UnityPlayerActivity".
    • Maybe this bug is related to this question : http://stackoverflow.com/questions/31004245/push-notification-does-not-launch-the-background-app-first-time-android. But as I'm not a native android developer some answers are above my level and understanding of this system.
    So my questions are:
    • Could you test if you can reproduce this error with one of your test Projects?
    • Could this happen because of some version miss-match of other plug-ins using gcm.jar, classes.jar, android-support-v4.jar in our app?
    • And last but not least do you have maybe any idea or hint whats going on? ;)
    I thank you in advanced for your support and look forward to hear from you.

    P.S.: I'm adding you my Android Manifest file maybe you could have a short look also on this one
    Code (CSharp):
    1. (Note: I only replaced in this file the bundle identifier and the Facebook ID)
    2. <?xml version="1.0" encoding="utf-8"?>
    3. <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.my.appname" android:versionName="2.0" android:versionCode="2">
    4.   <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    5.   <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">
    6.  
    7.     <!-- Google Play Service Block Start -->
    8.     <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
    9.     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    10.     <!-- Block End -->
    11.  
    12.     <!-- Google Cloud Service Block Start -->
    13.     <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/app_id" />
    14.     <!-- Block End -->
    15.  
    16.  
    17.     <!-- URL Handler Block Start -->
    18.     <activity android:name="com.my.appname" android:label="@string/app_name">
    19.       <intent-filter>
    20.         <action android:name="android.intent.action.VIEW" />
    21.         <category android:name="android.intent.category.DEFAULT" />
    22.         <category android:name="android.intent.category.BROWSABLE" />
    23.         <category android:name="android.intent.category.LAUNCHER" />
    24.         <data android:scheme="appname://" android:host="com.my.appname"/>
    25.       </intent-filter>
    26.     </activity>
    27.     <!-- Block End -->
    28.  
    29.     <!---android:launchMode="singleTask"-->
    30.     <activity android:name="com.androidnative.AndroidNativeBridge" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
    31.       <intent-filter>
    32.         <action android:name="android.intent.action.MAIN" />
    33.         <category android:name="android.intent.category.LAUNCHER" />
    34.       </intent-filter>
    35.    
    36.  
    37.       <!-- Twitter Block Start -->
    38.       <intent-filter>
    39.         <action android:name="android.intent.action.VIEW" />
    40.         <category android:name="android.intent.category.DEFAULT" />
    41.         <category android:name="android.intent.category.BROWSABLE" />
    42.         <data android:scheme="oauth" android:host="com.my.appname" />
    43.       </intent-filter>
    44.       <!-- Block End -->
    45.  
    46.  
    47.       <!-- Google Mobile Ad Block Start -->
    48.       <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    49.       <!-- Block End -->
    50.     </activity>
    51.  
    52.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    53.     <intent-filter>
    54.             <action android:name="android.intent.action.MAIN" />
    55.             <category android:name="android.intent.category.LAUNCHER" />
    56.         </intent-filter>
    57.     </activity>
    58.              
    59.     <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    60.         <intent-filter>
    61.             <action android:name="android.intent.action.MAIN" />
    62.             <category android:name="android.intent.category.LAUNCHER" />
    63.         </intent-filter>
    64.         <meta-data android:name="android.app.lib_name" android:value="unity" />
    65.         <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    66.     </activity>
    67.  
    68.     <!-- Google Mobile Ad Block Start -->
    69.     <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
    70.     <!-- Block End -->
    71.  
    72.  
    73.     <!-- Facebook Block Start -->
    74.     <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\
    75. XXXXXXXXXXX" />
    76.     <activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    77.     <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
    78.     </activity>
    79.     <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
    80.     </activity>
    81.     <!-- Block End -->
    82.  
    83.  
    84.     <!-- ImagePicker Block Start -->
    85.     <activity android:name="com.ElicitIce.Plugin.ImagePicker" android:label="@string/app_name">
    86.     </activity>
    87.     <!-- Block End -->
    88.  
    89.  
    90.     <!-- Google Cloud Message Block Start
    91.     <receiver android:name="com.androidnative.features.notifications.LocalNotificationReceiver">
    92.     </receiver>
    93.     <receiver android:exported="true" android:name="com.androidnative.gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
    94.       <intent-filter>
    95.         <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    96.         <category android:name="com.my.appname" />
    97.       </intent-filter>
    98.     </receiver>
    99.     <service android:name="com.androidnative.gcm.GcmIntentService" />
    100.      Block End -->
    101.  
    102.  
    103.     <!-- GCM java -->
    104.     <service android:enabled="true" android:name="com.my.appname.GCMJava" /> <!-- android:name must coincide with GCMJava package name + .GCMJava -->
    105.     <receiver
    106.      android:name="com.google.android.gcm.GCMBroadcastReceiver"
    107.      android:permission="com.google.android.c2dm.permission.SEND" >
    108.          <intent-filter>
    109.              <!-- Receives the actual messages. -->
    110.              <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    111.              <!-- Receives the registration id. -->
    112.              <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    113.              <category android:name="com.my.appname" /> <!-- android:name must coincide with GCMJava package name -->
    114.          </intent-filter>
    115.     </receiver>
    116.     <service android:name="com.my.appname.GCMIntentService" /> <!-- android:name must coincide with GCMJava package name + .GCMIntentService-->
    117.     <!-- end -->
    118.  
    119.  
    120.     <!-- File Sharing Block -->
    121.     <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.my.appname.fileprovider" android:exported="false" android:grantUriPermissions="true">
    122.       <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
    123.     </provider>
    124.     <!-- Block End -->
    125.  
    126.  
    127.   </application>
    128.   <uses-feature android:glEsVersion="0x00020000" />
    129.   <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18" />
    130.   <uses-permission android:name="android.permission.INTERNET" />
    131.   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    132.  
    133.   <!-- Android GCM Plugin -->
    134.   <permission android:name="com.my.appname.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    135.   <uses-permission android:name="com.my.appname.permission.C2D_MESSAGE" />
    136.   <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    137.   <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    138.   <uses-permission android:name="android.permission.WAKE_LOCK" />
    139.   <!-- Android GCM Plugin -->
    140.  
    141. </manifest>
     
  22. F-G

    F-G

    Joined:
    Apr 22, 2013
    Posts:
    2
    Hi Carlos,

    I could solve the bug on my own. The Problem was the android manifest file, I cleaned it and removed the following code:

    Code (CSharp):
    1. <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    2.         <intent-filter>
    3.             <action android:name="android.intent.action.MAIN" />
    4.             <category android:name="android.intent.category.LAUNCHER" />
    5.         </intent-filter>
    6.         <meta-data android:name="android.app.lib_name" android:value="unity" />
    7.         <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    8.     </activity>
    When I removed this activity, the app works fine.
     
  23. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @F.G.: I am glad the problem got solved! Apologies for not being able to answer earlier, Christmas holidays and some travelling got in the way!
     
  24. Katliyam61

    Katliyam61

    Joined:
    Jan 30, 2016
    Posts:
    7
    Hi ,

    I can do push notification like Whatsapp with your plugin ? Sorry my english. :)

    I want listen to server. If server change any variable , plugin run c# codes on Unity.
     
  25. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hello Katliyam61,

    The plugin gives you the base code to produce a messaging service, but to develop some of the features of WhatsApp you will need to tweak and implement certain aspects. This is what you get with ECPN:

    1) Client code (android) for registering your device on the GCM / Apple service
    2) Client code for sending information to the server (to initiate messages to all devices)
    3) Server code (PHP) to handle device registrations
    4) Server code to request broadcasting of messages to devices (requests to GCM or Apple services). Out of the box the message is sent to ALL users, but it is not difficult to change this to target only specific users (in the manual I suggest this as an improvement).

    Hope this helps!
     
  26. Renan-Reis

    Renan-Reis

    Joined:
    Dec 9, 2012
    Posts:
    11
    Hi Carlos,

    I would like to play sound when I received the notification. Is it possible?

    Best Regards,