Skip to content

Commit

Permalink
Start app on system launch, NotificationsService that will keep app r…
Browse files Browse the repository at this point in the history
…unning in background, special connection to receive update only about new messages, option to disable NotificationsService
  • Loading branch information
DrKLO authored and hav3n committed Jun 18, 2014
1 parent dd62af7 commit 0193667
Show file tree
Hide file tree
Showing 25 changed files with 379 additions and 156 deletions.
2 changes: 0 additions & 2 deletions TMessagesProj/config/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@

<uses-library android:name="com.google.android.maps" android:required="false"/>

<service android:name=".AwakeService"/>

</application>

</manifest>
2 changes: 0 additions & 2 deletions TMessagesProj/config/release/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@

<uses-library android:name="com.google.android.maps" android:required="false"/>

<service android:name=".AwakeService"/>

</application>

</manifest>
10 changes: 10 additions & 0 deletions TMessagesProj/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<application
android:allowBackup="false"
Expand Down Expand Up @@ -144,6 +145,15 @@
android:resource="@xml/contacts" />
</service>

<service android:name="org.telegram.messenger.NotificationsService" android:enabled="true"/>

<receiver android:name="org.telegram.messenger.AppStartReceiver" android:enabled="true">
<intent-filter>
<action android:name="org.telegram.start" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* This is the source code of Telegram for Android v. 1.4.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/

package org.telegram.messenger;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import org.telegram.ui.ApplicationLoader;

public class AppStartReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
ApplicationLoader.startPushService();
}
});
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ private void genereateNewSessionId() {
sessionId = isDebugSession ? (0xabcd000000000000L | (newSessionId & 0x0000ffffffffffffL)) : newSessionId;
}

public void setSessionId(long id) {
sessionId = id;
}

public long getSissionId() {
return sessionId;
}
Expand Down
Loading

0 comments on commit 0193667

Please sign in to comment.