mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-07-04 05:06:40 +00:00
Add broadcast received to detect connectivity changes (only detect there is a change a this time, we need to know what change is it and if we need to do something)
* Also remove useless function into IncomingSms * Add new notification type DEBUG to debug program if no debogger was available when dev
This commit is contained in:
parent
45c480106b
commit
112d520385
@ -93,6 +93,12 @@
|
|||||||
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".broadcast_receivers.ConnectivityChanged">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.LoginActivity"
|
android:name=".activities.LoginActivity"
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package fr.unix_experience.owncloud_sms.broadcast_receivers;
|
||||||
|
|
||||||
|
import fr.unix_experience.owncloud_sms.notifications.OCSMSNotificationManager;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
public class ConnectivityChanged extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Log.d(TAG,"ConnectivityChanged.onReceive");
|
||||||
|
(new OCSMSNotificationManager(context)).setDebugMsg("ConnectivityChanged");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String TAG = ConnectivityChanged.class.getSimpleName();
|
||||||
|
}
|
@ -29,10 +29,6 @@ public class IncomingSms extends BroadcastReceiver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
launchSmsObserver(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void launchSmsObserver(Context context) {
|
|
||||||
if (_mboxObserver == null) {
|
if (_mboxObserver == null) {
|
||||||
Log.d(TAG,"_mboxObserver == null");
|
Log.d(TAG,"_mboxObserver == null");
|
||||||
_mboxObserver = new SmsObserver(new Handler(), context);
|
_mboxObserver = new SmsObserver(new Handler(), context);
|
||||||
|
@ -20,4 +20,5 @@ package fr.unix_experience.owncloud_sms.enums;
|
|||||||
public enum OCSMSNotificationType {
|
public enum OCSMSNotificationType {
|
||||||
SYNC,
|
SYNC,
|
||||||
SYNC_FAILED,
|
SYNC_FAILED,
|
||||||
|
DEBUG,
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,12 @@ public class OCSMSNotificationManager {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDebugMsg(String errMsg) {
|
||||||
|
createNotificationIfPossible(OCSMSNotificationType.DEBUG,
|
||||||
|
"DEBUG", errMsg
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private void createNotificationIfPossible(OCSMSNotificationType nType, String nTitle, String nMsg) {
|
private void createNotificationIfPossible(OCSMSNotificationType nType, String nTitle, String nMsg) {
|
||||||
_notification.createNotify(nType, nTitle, nMsg);
|
_notification.createNotify(nType, nTitle, nMsg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user