android中的假呼叫
大家好 我想在android中开发一个假的呼叫应用程序。点击按钮后,我必须在给定的时间段内收到一个假电话。有没有办法做到这一点。。android中的假呼叫,android,Android,大家好 我想在android中开发一个假的呼叫应用程序。点击按钮后,我必须在给定的时间段内收到一个假电话。有没有办法做到这一点。。 有任何线索或样本代码。。。?请让我知道..提前谢谢。Android是开源的。用它 在中,您可以找到和,它们用于显示来电屏幕。特别是java文件非常长且复杂,但是布局(当然,与它引用的资源相结合)应该可以为您提供一个相当准确的默认Android调用屏幕副本。按钮单击事件类: 将报警管理器设置为intent Intent intent = new Intent(this
有任何线索或样本代码。。。?请让我知道..提前谢谢。Android是开源的。用它
在中,您可以找到和,它们用于显示来电屏幕。特别是java文件非常长且复杂,但是布局(当然,与它引用的资源相结合)应该可以为您提供一个相当准确的默认Android调用屏幕副本。按钮单击事件类: 将报警管理器设置为intent
Intent intent = new Intent(this, FakeCallReciever.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 1222222, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
if (mTimer.getText().toString().trim().equalsIgnoreCase("5 sec")) {
int i = 5;
alarmManager.set(AlarmManager.RTC_WAKEUP,System.currentTimeMillis() + (i * 1000), pendingIntent);
Toast.makeText(this, "Fake call scheduled after " + i + " sec",Toast.LENGTH_LONG).show();
}
else if (mTimer.getText().toString().trim().equalsIgnoreCase("10 sec")) {
int i = 10;
alarmManager.set(AlarmManager.RTC_WAKEUP,System.currentTimeMillis() + (i * 1000), pendingIntent);
Toast.makeText(this, "Fake call scheduled after " + i + " sec",Toast.LENGTH_LONG).show();
}
FakeCallReceiver.class:
public class FakeCallReciever extends BroadcastReceiver {
private PowerManager.WakeLock mWakelock;
@SuppressWarnings("deprecation")
private KeyguardManager.KeyguardLock mLock;
private static ContentResolver sResolver;
/**
* onReceive for Reciever
*/
@SuppressWarnings("deprecation")
@Override
public void onReceive(Context paramContext, Intent intent) {
this.mWakelock = ((PowerManager) paramContext.getSystemService("power"))
.newWakeLock(805306394/* | PowerManager.ON_AFTER_RELEASE */,
"wakelock");
this.mWakelock.acquire();
this.mLock = ((KeyguardManager) paramContext
.getSystemService("keyguard")).newKeyguardLock("");
this.mLock.disableKeyguard();
if (Constants.LOG)
Log.d("FAkceREciever Call", "================>");
setLockPatternEnabled(true);
sResolver = paramContext.getContentResolver();
Intent startMain = new Intent();
startMain = new Intent(paramContext, InComingCall.class);
startMain.setAction("com.example.fakecall.MyService");
startMain.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
paramContext.startActivity(startMain);
}
/**
* used for to enable lock in all patterns
*
* @param enabled
*/
@SuppressWarnings("deprecation")
public static void setLockPatternEnabled(boolean enabled) {
setBoolean(android.provider.Settings.System.LOCK_PATTERN_ENABLED,
enabled);
}
private static void setBoolean(String systemSettingKey, boolean enabled) {
android.provider.Settings.System.putInt(sResolver, systemSettingKey,
enabled ? 1 : 0);
}
}
==================
InComingCall.class:
进行来电活动以显示虚拟假来电屏幕
这对我很有用。@Bobby..谢谢你的想法..请告诉我如何显示带有接受和拒绝选项的假来电屏幕..或任何示例代码..提前感谢你的帮助。我不知道,我不做Android编程…只需创建一个应用程序并将其样式设置为类似来电屏幕的样式。如果你不知道怎么做…你可能想找一些关于Android编程的教程或好书。很好,这听起来像Play Store上的假呼叫应用程序,你的来电在哪里?请发布完整的代码。输入类是带有数字的UI,接受和拒绝按钮Google已经移动了Android源代码。现在可以在这里找到手机应用程序的来源: