我已经尝试过此代码,但我没有在帐户中看到共享照片.
File file = new File("sdcard/1346249742258.jpg");
String photoUri = null;
photoUri = file.getAbsolutePath();
Intent shareIntent = ShareCompat.IntentBuilder.from(this)
.setText("Sharing an image on Google!").setType("image/jpeg")
.setStream(Uri.parse(photoUri)).getIntent()
.setPackage("com.google.android.apps.plus");
startActivity(shareIntent);
Run Code Online (Sandbox Code Playgroud) 我正在使用phonegapand我正在注册onDeviceReady后退按钮功能,但在点击设备的后退按钮时调用函数.我已经添加了
<script src="lib/cordova-2.6.0.js"></script>
document.addEventListener("backbutton", onBackClickEvent, false);
function onBackClickEvent() {
alert("back onBackClickEvent");
}
Run Code Online (Sandbox Code Playgroud)
这个onBackClickEvent()功能没有被调用,我从来没有看到过这个警报.我也收到了Uncaught ReferenceError错误:cordova未定义
可能是什么错误请建议我.提前致谢.
我已经在启动完成时在android上启动了9:00 AM的警报.但是在完成启动后每分钟都会发出警报.
我的要求是它应该在启动后设置警报,但仅在上午9:00触发警报.
这是我的代码:public class AlarmUtil {private PendingIntent alarmIntent;
public static void setAlarm(Context context) {
AlarmManager alarmManager = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 9);
calendar.set(Calendar.MINUTE, 00);
calendar.set(Calendar.SECOND, 00);
calendar.set(Calendar.AM_PM, Calendar.AM);
//calendar.setTimeInMillis(calendar.getTimeInMillis());
calendar.add(Calendar.SECOND, 1);
Intent intent = new Intent(context, Services.class);
PendingIntent pintent = PendingIntent.getService(context, 123456789,
intent, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(), 1 * 60 * 1000, pintent);
}
}
public class AlarmBroadcastReciever extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
Toast.makeText(context, "Booted!", Toast.LENGTH_SHORT).show();
AlarmUtil.setAlarm(context); …Run Code Online (Sandbox Code Playgroud)