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.