android如何开机自动导入联系人 android开机的时候不自动导入联系人,需要在联系人界面,点击“menu”,然后选择“导入/导出联系人”,请问如何实现开机的时候系统自动从SIM卡导入联系人呢? 另外请教一下,android学习有什么好的书吗?入门级就行 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个应用层做不了吧?! 入门级的书 , 《Android开发入门与实战》和《Android SDK开发范例大全》都不错 这个肯定可以做,三星的android就实现了自动导入,就是不知道怎么做 添加 开机监听 的receiver然后直接调用导入联系人的方法不过这样也得重新编译 或者自己弄个apk具体的方法就得看源代码了 public static void doImportFromSdCard(Context context, Account account) { if (account != null) { GoogleSource.createMyContactsIfNotExist(account, context); } Intent importIntent = new Intent(context, ImportVCardActivity.class); if (account != null) { importIntent.putExtra("account_name", account.name); importIntent.putExtra("account_type", account.type); } context.startActivity(importIntent); }启动时直接运行那个activity就可以了不过很多依赖的都在framework里面、、、、可以考虑只提取需要的不知道能不能实现。。 这两天比较忙,对于android一点也不懂,呵呵,等我先试试 呵呵,我的做法是监听开机完成的广播,然后起后台服务去完成导入操作。但是这个做法不好的地方时在开机完成广播是在快进luncher界面才发出的。显得有点晚。个人觉得最好的做法是修改framework,新写一个服务挂在android的系统服务里,等到sim卡初始化完成后立马去做导入sim卡的操作。这个也只有手机厂商才会才能去做吧 我也是在监听开机的动作,但是为什么开机的时候弹出The application Boot(process.com.blessdyb.boot)has stopped unexpectedly. Please try again代码如下package com.blessdyb.boot;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.util.Log;public class BootBroadcastReceiver extends BroadcastReceiver { private static final String LOG_TAG = "boot1"; @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ Intent importIntent = new Intent(Intent.ACTION_VIEW); importIntent.setType("vnd.android.cursor.item/sim-contact"); importIntent.setClassName("com.android.phone", "com.android.phone.SimContacts"); context.startActivity(importIntent); } }} 哎呀呀,搞定啦,代码如下:package com.blessdyb.boot;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.util.Log;public class BootBroadcastReceiver extends BroadcastReceiver { private static final String LOG_TAG = "boot1"; @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ Intent importIntent = new Intent(Intent.ACTION_VIEW); importIntent.setType("vnd.android.cursor.item/sim-contact"); importIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //broadcastreceiver调用外部的activity必须设置的flag importIntent.setClassName("com.android.phone", "com.android.phone.SimContacts"); context.startActivity(importIntent); } }}呵呵,可惜啊,1.6调用这个activity好像直接可以导入联系人,但是2.1调用这个activity之后会弹出让用户选择导入哪个联系人。。呕吐谁会在framework的地方导入啊,晕啊 其实你可以把phone里simcontacts的代码扣出来自己写嘛不就可以自己从后台导了?至于framework里怎么修改的话我的建议是先研究怎么把自己写的服务挂到android的系统服务里去让系统在比较早, sim卡初始化好就调用 可以参照LG P500的做法在开机启动启动一个service把卡里联系人导入到手机中可以收到这个广播时做的 INTENT_VALUE_ICC_LOADED 楼主这样只是实现了开机自动将sim卡的联系人显示了 但是并没有导入到通讯录 那怎么实现开机自动导入呢? android如何实现文本框的单击展开与隐藏(类似QQ好友组展开隐藏) webview 中浏览 维基百科的问题!在线等 android widget动画效果 求 关于Google map 无法显示的错误 (Couldn't get connection factory client) 各位前辈,想实现这样的效果 JNI不懂 新手,关于android定位的问题 Android MobileMedia 完整支持DLNA,兼容Intel WiDi 仿网易图片轮播 如何获取联系人的高清头像? 如何在activity直接传递对象,而非数据? android使用post连服务器问题
入门级的书 , 《Android开发入门与实战》和《Android SDK开发范例大全》都不错
然后直接调用导入联系人的方法
不过这样也得重新编译 或者自己弄个apk
具体的方法就得看源代码了
if (account != null) {
GoogleSource.createMyContactsIfNotExist(account, context);
} Intent importIntent = new Intent(context, ImportVCardActivity.class);
if (account != null) {
importIntent.putExtra("account_name", account.name);
importIntent.putExtra("account_type", account.type);
}
context.startActivity(importIntent);
}启动时直接运行那个activity就可以了
不过很多依赖的都在framework里面、、、、
可以考虑只提取需要的不知道能不能实现。。
然后起后台服务去完成导入操作。
但是这个做法不好的地方时在开机完成广播是在快进luncher界面才发出的。
显得有点晚。个人觉得最好的做法是修改framework,新写一个服务挂在android的系统服务里,
等到sim卡初始化完成后立马去做导入sim卡的操作。这个也只有手机厂商才会才能去做吧
The application Boot(process.com.blessdyb.boot)has stopped unexpectedly. Please try again
代码如下package com.blessdyb.boot;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;public class BootBroadcastReceiver extends BroadcastReceiver {
private static final String LOG_TAG = "boot1";
@Override
public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
Intent importIntent = new Intent(Intent.ACTION_VIEW);
importIntent.setType("vnd.android.cursor.item/sim-contact");
importIntent.setClassName("com.android.phone", "com.android.phone.SimContacts");
context.startActivity(importIntent);
}
}
}
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;public class BootBroadcastReceiver extends BroadcastReceiver {
private static final String LOG_TAG = "boot1";
@Override
public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
Intent importIntent = new Intent(Intent.ACTION_VIEW);
importIntent.setType("vnd.android.cursor.item/sim-contact");
importIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //broadcastreceiver调用外部的activity必须设置的flag
importIntent.setClassName("com.android.phone", "com.android.phone.SimContacts");
context.startActivity(importIntent);
}
}
}
呵呵,可惜啊,1.6调用这个activity好像直接可以导入联系人,但是2.1调用这个activity之后会弹出让用户选择导入哪个联系人。。呕吐谁会在framework的地方导入啊,晕啊
不就可以自己从后台导了?
至于framework里怎么修改的话
我的建议是先研究怎么把自己写的服务挂到android的系统服务里去
让系统在比较早, sim卡初始化好就调用