I’m doing a game that needs to access the calendar in the mobile and save an event, i’ve build a java code and created a .jar file using Dr. Java:
package com.company.productname;
import com.unity3d.player.UnityPlayer;
import com.unity3d.player.UnityPlayerActivity;
import java.util.Calendar;
import android.os.Bundle;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.Context;
import android.util.Log;
import android.os.Handler;
public class CalendarDate {
public void addEvent(Context ctx, String title) {
//Log.d(TAG, "AddUsingIntent.addEvent()");
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", title);
//intent.putExtra("beginTime", start.getTimeInMillis());
//intent.putExtra("endTime", end.getTimeInMillis());
intent.putExtra("allDay", true);
ctx.startActivity(intent);
}
}
and i’ve added to the mannifest:
<service android:name="es.astronauts.opengl.CalendarDate" />
to be able to access from a C# code, the code is:
#if UNITY_ANDROID
private AndroidJavaObject playerActivityContext;
#endif
// Use this for initialization
void Start () {
inicio = 2015914730;
fin = 2015914830;
#if UNITY_ANDROID && !UNITY_EDITOR
// Obtain unity context
if(playerActivityContext == null) {
AndroidJavaClass actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
playerActivityContext = actClass.GetStatic<AndroidJavaObject>("currentActivity");
}
AndroidJavaClass jc = new AndroidJavaClass(packageName + ".CalendarDate");
jc.CallStatic("addEvent", playerActivityContext,Title);
#endif
}
but when i build i get the next error:
can anyone help me?
Thank you so much!!