2010-09-15 51 views
3

HI全部,在android中假冒電話

我想在android中開發一個虛假的通話應用程序。點擊按鈕後,我必須在給定的時間段內收到假電話。有沒有辦法做到這一點.. 任何線索或示例代碼...?請讓我知道..提前感謝。

+0

@ Bobby ..感謝您的想法..請給我想法如何顯示假的來電屏幕接受和拒絕選項..或任何示例代碼..感謝您的幫助提前。 – 2010-09-15 11:02:44

+0

我不知道,我沒有做Android編程...只是創建一個應用程序和它的樣式,它看起來像傳入呼叫屏幕。如果你不知道如何做到這一點...你可能想要挖掘一些關於Android編程的教程或好書。 – Bobby 2010-09-16 12:12:40

+0

不錯,這聽起來像Play商店的假呼叫應用程序,http://oopsreview.com/create-fake-incoming-phone-call-android/ – yussan 2017-01-24 09:29:58

回答

8

Android是開源的。用它!

Phone app on the git repository中,您可以找到call_card.xmlCallCard.java,它們用於顯示來電屏幕。特別是java文件非常長和複雜,但是佈局(當然,與它所引用的資源結合起來)應該會給你一個相當準確的默認Android通話屏幕副本。

+0

鏈接不在這裏工作。 – 2016-04-02 05:14:55

+0

Google已移動Android來源。電話應用程序的來源可以在這裏找到:https://android.googlesource.com/platform/packages/apps/Phone.git – benvd 2016-04-02 09:26:43

1

按鈕單擊事件類:

設置報警經理意圖

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(); 
} 

FakeCallReciever.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:

來電來電顯示虛假來電scr EEN。

它正在爲我工​​作。

+0

你的incoming.class在哪裏?請發佈完整的代碼。 – 2016-04-02 05:28:03

+0

incoing class是UI用數字和接受和拒絕按鈕 – 2016-06-10 08:26:44