Many Greetings
Timo
Unable to find explicit activity class {com.google.android.calendar/com.android.calendar.LaunchActivity}; have you declared this activity in your AndroidManifest.xml?"<uses-permission android:name="android.permission.READ_CALENDAR"></uses-permission>
to AndroidManifest.xml ..Unable to find explicit activity class {com.google.android.calendar/com.android.calendar.LaunchActivity}; have you declared this activity in your AndroidManifest.xml?".If you change the packageName line in Timo's example to:
var packageName = "com.google.android.calendar";
there is no debugger error and the calendar appears on the screen. However, no new calendar entry is made.
Adding :
_AddPermissions("WRITE_CALENDAR");
to the top of the script also has no effect, but I think both of these changes are a good step forward.
I will devote more time to this when script when possible.
There are a limited number of fields that can be modified using this method.
You don't need to add any permissions to the code because it automatically brings up a calendar application. If then pre-populate the number of fields and allows you to save it to the calendar.
If you have a number of email addresses, and have calendars for each one of them, this program will simply pick the last email address use for the last calendar entry made. As far as I can determine there is no control over what calendar you put the entry into with the send intent method.
In order to gain more control over information that is in the calendar, I believe the sync adapter method must be used, which is what I am going to be investigating next.
The following code does work for making calendar entries with the send intent method.
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
btn = app.CreateButton( "Send Intent", 0.3, 0.1 );
btn.SetOnTouch( cal_si_insert );
lay.AddChild( btn );
app.AddLayout( lay );
}
function cal_si_insert()
{
var today = new Date().getTime();
var packageName = null;
var className = null;
var action = "android.intent.action.INSERT";
var category = null;
var uri = "android.intent.Events.CONTENT_URI";
var type = "vnd.android.cursor.item/event";
var extras = [
{name:"description", type:"string", value:"DS SendIntent Description"},
{name:"title", type:"string", value: "DS SendIntent Title"},
{name:"beginTime", type:"long", value: today},
{name:"eventLocation", type:"string", value: "DS SendIntent Address"},
{name:"endTime", type:"long", value: today + 3600000},
]