1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-07 07:56:14 +00:00

Require Android 4.4 to restore messages

This commit is contained in:
Loic Blot 2016-12-07 08:41:31 +01:00
parent 52e7fa109b
commit 45d7352c32
3 changed files with 10 additions and 1 deletions

View File

@ -35,6 +35,10 @@ public class RestoreMessagesActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_restore_messages);
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
// Change message to define Android 4.4 or greated is required
return;
}
assert getIntent().getExtras() != null;

View File

@ -37,7 +37,12 @@ public interface ASyncSMSRecovery {
@Override
protected Void doInBackground(Void... params) {
// This feature is only available for Android 4.4 and greater
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
return null;
}
Log.i(ASyncSMSRecovery.TAG, "Starting background recovery");
Long start = (long) 0;
JSONObject obj = new OCSMSOwnCloudClient(_context, _account).retrieveSomeMessages(start, 500);
try {

View File

@ -20,7 +20,6 @@ package fr.unix_experience.owncloud_sms.engine;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
@ -41,6 +40,7 @@ public interface ASyncSMSSync {
@Override
protected Void doInBackground(Void... params) {
Log.i(ASyncSMSSync.TAG, "Starting background sync");
// Get ownCloud SMS account list
AccountManager _accountMgr = AccountManager.get(_context);
Account[] myAccountList = _accountMgr.getAccountsByType(_context.getString(R.string.account_type));