Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by USUM · Nov 03, 2016 at 12:43 PM · androidpluginpush notification

Unity android FCM

I'm trying to add Google FCM push notification function to Unity project. I'm surprised that there are no resources about Google FCM for Unity. There are only old Google GCM resources. This is my step-by-step progress below.

  1. Make Android Studio project and register it to a FCM console project

  2. Add google-service.json to '/app' and configure build.gradle (project and module)

  3. Add MyFirebaseInstanceIDService, MyFirebaseMessagingService java classes and onTokenRefresh, sendRegistrationToServer, onMessageReceived, sendNotification methods according to sample example in FCM document

  4. Add services for the classes to AndroidManifest.xml

    After that, I tested the Android Studio project on mobile, and FCM console push notification works well. Then, I started to configure the Android Studio project for Unity.

  5. Change 'application' to 'library' in build.gradle (module) and add deleteOldJar, exportJar for AndroidPlugin.jar

  6. Add classes.jar of Unity to Android Studio library and module setting

  7. Remove 'android:icon ...', 'android:theme ...' in AndroidManifest.xml

  8. Export jar and add AndroidPlugin.jar, AndroidManifest.xml to 'Plugins/Android' in Unity

    Then, I tested the Unity project on mobile. It is built without exception, but FCM console push notification didn't work. (I made test log for confirming that the Android Studio libray is well plugined for Unity, the log worked well)

Maybe, there are somethings to add to 'Plugins/Android' except AndroidManifest.xml and AndroidPlugin.jar like references below.

http://stackoverflow.com/questions/37497363/google-firebase-analytics-plugin-for-unity http://joxi.ru/Q2KeQD7C3zdYrj

But, I couldn't find my answer. Please let me know what I have to do or add. Sorry for bad english and long explanation. Many thanks :)

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hyper00 · Nov 04, 2016 at 04:24 AM 1
Share

ну что решил проблему? нужно добавить класс с файла *.jar и проверь протестируй принимаются ли тестовые функции с строками и целыми числами и т.п.

Well, that solved the problem? you need to add a class to the * .jar file, and check whether the test received the test function with strings and integers, etc.

avatar image USUM Hyper00 · Nov 04, 2016 at 06:44 AM 0
Share

No, I couldn't solve the problem. If I understand your comment, I tested for the android plugin in $$anonymous$$ainActivity.class. Like below.

In Android, $$anonymous$$ainAcitivity

 package com.example;
 
 import android.os.Bundle;
 
 import com.unity3d.player.UnityPlayer;
 import com.unity3d.player.UnityPlayerActivity;
 
 public class $$anonymous$$ainActivity extends UnityPlayerActivity {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         // setContentView(R.layout.activity_main);
 
         // call from native.
         UnityPlayer.UnitySend$$anonymous$$essage("$$anonymous$$ain Camera", "CallFromNative", "NativeCallFromUnity call test");
     }
 }

And then, using device logcat, I could be sure that the plugin is well connected.

 I/Unity   (24194): NativeCallFromUnity call test

I've been trying so many times adding jar and aar files like the links above, but it's not working yet.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Hyper00 · Nov 06, 2016 at 08:25 PM

И я остановился на той же проблеме. Юниты3Д подключаете и использует классы .арр. Но не понятно, на самом деле, что запускает, "приемник" Уведомления?! И запускается ли она, не в как приложении, а как в модуле. Ведь в Андроид Студии мы же переключаем в режим модуля. Пока ищу в просторах интернета, может где добавить в АндроидМанифест.хмл какие-то разрешения И без разницы или .arr или *.jar. Здесь, что-то другое упустили с вида...

And I has stopped on the same issue. Unity3D connect and use classes .arr. But do not understand, in fact, that starts, "receiver" Notifications ?! And can it is run, not as an application, but as a module. After all, Android Studio, we also switched to the mode of the module. While looking into the Internet open spaces, which can add to AndroidManifest.hml any resolution And without a difference, or .arr or *.jar. Here is something else to kind of lost ...

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hyper00 · Nov 06, 2016 at 08:04 PM 0
Share

может это, только не УнеСигнал а FC$$anonymous$$ maybe it's just not OneSignal and FC$$anonymous$$ https://documentation.onesignal.com/docs/unity-sdk-setup

avatar image USUM · Nov 14, 2016 at 08:59 AM 0
Share

I used Unity SD$$anonymous$$ on OneSignal. It is simple and cool SD$$anonymous$$. Thanks :)

https://onesignal.com/

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Need some help with Unity Airpush plugin 0 Answers

raw folder and files can not be found after build 0 Answers

Unity android Plugin MediaScan Question.,Android native plugin MediaScan Question 0 Answers

Android push notification white icon 0 Answers

Android Native Plugin : onNewIntent not working when launching the app 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges