Unity Android Local Notification, unityandroid

Source: Internet
Author: User
Tags android games

Unity Android Local Notification, unityandroid
Record that local notifications of the Android version of Unity games are implemented through plug-ins. Refer to this document. Make a slight modification. Related Files and code are shared on Github.
Steps1,In Windows, double-click cdz_build.bat. An AlarmReceiver. jar file is generated in the current directory.
2,Copy AlarmReceiver. jar to the Assets \ Plugins \ Android \ libs \ directory of the Unity project.
3,Generate a local notification:

AndroidJavaObject nativeObj = new AndroidJavaObject("com.macaronics.notification.AlarmReceiver");nativeObj.CallStatic("startAlarm", new object[5]{title,title, msg, secondsFromNow, triggerTimeInt});
Parameter description: title: Notification title msg: Notification content secondsFromNow: the time when the notification is sent, and the current number of seconds triggerTimeInt: a random number
Cancel all local notifications:
AndroidJavaObject playerActivityContext = null;using (var actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {playerActivityContext = actClass.GetStatic<AndroidJavaObject>("currentActivity");}using (AndroidJavaClass javaClass = new AndroidJavaClass("com.macaronics.notification.AlarmReceiver")){javaClass.CallStatic("clearNotification",playerActivityContext);}

Reference: Unity 3D + Local Notification for AndroidAndroid AlarmManager only solves the last valid problem when setting multiple scheduled events. BuilderHow exactly to use Notification. Builder

Document Information

  • Http://blog.csdn.net/cdztop/article/details/39699675
  • Last modification time:, January 1, October 01, 2014

An error occurred when Unity released android.

If jdk is installed and the jdk version is later than 1.6, you must configure the environment variable for jdk. You can run cmd and type javac. If the configuration is successful, if it is not successful, it is not configured or not configured.

Unity3D exported Android games cannot run on virtual machines

Maybe your model is too big. You can try new sence with a cube. I have tried the simulator to run simple, complex, and crash directly.

Unity3d apk is too slow to publish several MB to the simulator. Generally, press Ctrl + B to publish it with one click.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.