mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-28 02:06:11 +00:00
0.21.2: Android 6.0 permissions fixes
This commit is contained in:
parent
d7e1ec729f
commit
6759409188
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="fr.unix_experience.owncloud_sms"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="36"
|
||||
android:versionName="0.21.1"> <!-- From Android 4.0 to 6.0 -->
|
||||
android:versionCode="37"
|
||||
android:versionName="0.21.2"> <!-- From Android 4.0 to 6.0 -->
|
||||
<uses-sdk
|
||||
android:maxSdkVersion="23"
|
||||
android:minSdkVersion="14"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package fr.unix_experience.owncloud_sms.activities;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2014-2015, Loic Blot <loic.blot@unix-experience.fr>
|
||||
* Copyright (c) 2014-2016, Loic Blot <loic.blot@unix-experience.fr>
|
||||
* All rights reserved.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -25,11 +25,14 @@ package fr.unix_experience.owncloud_sms.activities;
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
@ -46,7 +49,12 @@ import fr.unix_experience.owncloud_sms.engine.ASyncSMSSync.SyncTask;
|
||||
import fr.unix_experience.owncloud_sms.engine.ConnectivityMonitor;
|
||||
import fr.unix_experience.owncloud_sms.engine.SmsFetcher;
|
||||
import fr.unix_experience.owncloud_sms.enums.OCSMSNotificationType;
|
||||
import fr.unix_experience.owncloud_sms.enums.PermissionID;
|
||||
import fr.unix_experience.owncloud_sms.notifications.OCSMSNotificationUI;
|
||||
import fr.unix_experience.owncloud_sms.prefs.PermissionChecker;
|
||||
|
||||
import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_MAX;
|
||||
import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_SMS;
|
||||
|
||||
public class MainActivity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener{
|
||||
@ -54,8 +62,8 @@ public class MainActivity extends AppCompatActivity
|
||||
private static ConnectivityMonitor mConnectivityMonitor = null;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (mConnectivityMonitor == null) {
|
||||
mConnectivityMonitor = new ConnectivityMonitor(getApplicationContext());
|
||||
if (MainActivity.mConnectivityMonitor == null) {
|
||||
MainActivity.mConnectivityMonitor = new ConnectivityMonitor(getApplicationContext());
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -88,11 +96,12 @@ public class MainActivity extends AppCompatActivity
|
||||
boolean res = true;
|
||||
|
||||
switch (id) {
|
||||
case R.id.nav_sync: res = syncAllMessages(); break;
|
||||
case R.id.nav_sync: syncAllMessages(); break;
|
||||
case R.id.nav_manage: res = openAppSettings(); break;
|
||||
case R.id.nav_rateus: res = openGooglePlayStore(); break;
|
||||
case R.id.nav_add_account: res = openAddAccount(); break;
|
||||
case R.id.nav_my_accounts: res = openMyAccounts(); break;
|
||||
case R.id.nav_appinfo_perms: res = openAppInfos(); break;
|
||||
}
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
@ -109,10 +118,15 @@ public class MainActivity extends AppCompatActivity
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean syncAllMessages () {
|
||||
public void syncAllMessages () {
|
||||
if (!PermissionChecker.checkPermission(this, Manifest.permission.READ_SMS,
|
||||
REQUEST_SMS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Context ctx = getApplicationContext();
|
||||
|
||||
if (mConnectivityMonitor.isValid()) {
|
||||
if (MainActivity.mConnectivityMonitor.isValid()) {
|
||||
// Now fetch messages since last stored date
|
||||
JSONArray smsList = new JSONArray();
|
||||
new SmsFetcher(ctx).bufferMessagesSinceDate(smsList, (long) 0);
|
||||
@ -126,7 +140,6 @@ public class MainActivity extends AppCompatActivity
|
||||
else {
|
||||
Toast.makeText(ctx, ctx.getString(R.string.err_sync_no_connection_available), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean openMyAccounts () {
|
||||
@ -145,4 +158,41 @@ public class MainActivity extends AppCompatActivity
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean openAppInfos () {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Permissions
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
PermissionID requestCodeID = REQUEST_MAX;
|
||||
if ((requestCode > 0) || (requestCode < REQUEST_MAX.ordinal())) {
|
||||
requestCodeID = PermissionID.values()[requestCode];
|
||||
}
|
||||
|
||||
switch (requestCodeID) {
|
||||
case REQUEST_SMS:
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
syncAllMessages();
|
||||
} else {
|
||||
// Permission Denied
|
||||
Toast.makeText(this, getString(R.string.err_cannot_read_sms) + " " +
|
||||
getString(R.string.please_fix_it), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,24 @@
|
||||
package fr.unix_experience.owncloud_sms.activities.remote_account;
|
||||
|
||||
import android.Manifest;
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
@ -22,13 +27,21 @@ import fr.unix_experience.owncloud_sms.R;
|
||||
import fr.unix_experience.owncloud_sms.adapters.ContactListAdapter;
|
||||
import fr.unix_experience.owncloud_sms.adapters.RecoveryPhoneNumberListViewAdapter;
|
||||
import fr.unix_experience.owncloud_sms.engine.ASyncContactLoad;
|
||||
import fr.unix_experience.owncloud_sms.enums.PermissionID;
|
||||
import fr.unix_experience.owncloud_sms.prefs.PermissionChecker;
|
||||
|
||||
import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_CONTACTS;
|
||||
import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_MAX;
|
||||
|
||||
public class ContactListActivity extends AppCompatActivity implements ASyncContactLoad {
|
||||
|
||||
static AccountManager _accountMgr;
|
||||
ContactListAdapter adapter;
|
||||
SwipeRefreshLayout _layout;
|
||||
ArrayList<String> objects;
|
||||
static AccountManager mAccountMgr;
|
||||
ContactListAdapter mAdapter = null;
|
||||
SwipeRefreshLayout mLayout = null;
|
||||
LinearLayout mContactInfos = null;
|
||||
ArrayList<String> mObjects;
|
||||
String mFetchedContact;
|
||||
RecoveryPhoneNumberListViewAdapter mContactPhoneListAdapter = null;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -41,49 +54,35 @@ public class ContactListActivity extends AppCompatActivity implements ASyncConta
|
||||
// accountName cannot be null, devel error
|
||||
assert accountName != null;
|
||||
|
||||
ContactListActivity._accountMgr = AccountManager.get(getBaseContext());
|
||||
ContactListActivity.mAccountMgr = AccountManager.get(getBaseContext());
|
||||
Account[] myAccountList =
|
||||
ContactListActivity._accountMgr.getAccountsByType(getString(R.string.account_type));
|
||||
ContactListActivity.mAccountMgr.getAccountsByType(getString(R.string.account_type));
|
||||
|
||||
// Init view
|
||||
objects = new ArrayList<>();
|
||||
mObjects = new ArrayList<>();
|
||||
setContentView(R.layout.restore_activity_contactlist);
|
||||
|
||||
_layout = (SwipeRefreshLayout) findViewById(R.id.contactlist_swipe_container);
|
||||
mLayout = (SwipeRefreshLayout) findViewById(R.id.contactlist_swipe_container);
|
||||
|
||||
adapter = new ContactListAdapter(getBaseContext(), objects);
|
||||
mAdapter = new ContactListAdapter(getBaseContext(), mObjects);
|
||||
|
||||
final Spinner sp = (Spinner) findViewById(R.id.contact_spinner);
|
||||
final LinearLayout contactInfos = (LinearLayout) findViewById(R.id.contactinfos_layout);
|
||||
mContactInfos = (LinearLayout) findViewById(R.id.contactinfos_layout);
|
||||
final ProgressBar contactProgressBar = (ProgressBar) findViewById(R.id.contactlist_pgbar);
|
||||
final ListView contactPhoneListView = (ListView) findViewById(R.id.contact_phonelistView);
|
||||
final RecoveryPhoneNumberListViewAdapter contactPhoneListAdapter =
|
||||
new RecoveryPhoneNumberListViewAdapter(getBaseContext());
|
||||
contactPhoneListView.setAdapter(contactPhoneListAdapter);
|
||||
mContactPhoneListAdapter = new RecoveryPhoneNumberListViewAdapter(getBaseContext());
|
||||
contactPhoneListView.setAdapter(mContactPhoneListAdapter);
|
||||
|
||||
contactInfos.setVisibility(View.INVISIBLE);
|
||||
mContactInfos.setVisibility(View.INVISIBLE);
|
||||
|
||||
sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
contactInfos.setVisibility(View.INVISIBLE);
|
||||
contactPhoneListAdapter.clear();
|
||||
mContactInfos.setVisibility(View.INVISIBLE);
|
||||
mContactPhoneListAdapter.clear();
|
||||
|
||||
String contactName = sp.getSelectedItem().toString();
|
||||
Vector<String> phoneList = fetchContact(contactName);
|
||||
Integer smsCount = 0;
|
||||
// @TODO asynctask to load more datas
|
||||
|
||||
if (!phoneList.isEmpty()) {
|
||||
for (String pn: phoneList) {
|
||||
contactPhoneListAdapter.add(pn);
|
||||
}
|
||||
} else {
|
||||
contactPhoneListAdapter.add(contactName);
|
||||
}
|
||||
|
||||
contactInfos.setVisibility(View.VISIBLE);
|
||||
contactPhoneListAdapter.notifyDataSetChanged();
|
||||
mFetchedContact = sp.getSelectedItem().toString();
|
||||
fetchContact(mFetchedContact);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,69 +90,119 @@ public class ContactListActivity extends AppCompatActivity implements ASyncConta
|
||||
// Nothing to do there
|
||||
}
|
||||
|
||||
private Vector<String> fetchContact(String name) {
|
||||
Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
|
||||
null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " = ?",
|
||||
new String[]{name}, null);
|
||||
if (people == null) {
|
||||
return new Vector<>();
|
||||
}
|
||||
|
||||
people.moveToFirst();
|
||||
|
||||
Vector<String> r = new Vector<>();
|
||||
if (people.getCount() == 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
String contactId = people.getString(people.getColumnIndex(ContactsContract.Contacts._ID));
|
||||
|
||||
if ("1".equalsIgnoreCase(people.getString(people.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)))) {
|
||||
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
|
||||
null,
|
||||
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
|
||||
new String[]{contactId}, null);
|
||||
|
||||
while ((phones != null) && phones.moveToNext()) {
|
||||
r.add(phones.getString(phones.getColumnIndex(
|
||||
ContactsContract.CommonDataKinds.Phone.NUMBER))
|
||||
.replaceAll(" ", ""));
|
||||
}
|
||||
|
||||
if (phones != null) {
|
||||
phones.close();
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
});
|
||||
sp.setAdapter(adapter);
|
||||
sp.setAdapter(mAdapter);
|
||||
|
||||
for (final Account element : myAccountList) {
|
||||
if (element.name.equals(accountName)) {
|
||||
// Load "contacts"
|
||||
contactProgressBar.setVisibility(View.VISIBLE);
|
||||
new ContactLoadTask(element, getBaseContext(), adapter, objects, _layout, contactProgressBar, contactInfos).execute();
|
||||
new ContactLoadTask(element, getBaseContext(), mAdapter, mObjects, mLayout, contactProgressBar, mContactInfos).execute();
|
||||
|
||||
// Add refresh handler
|
||||
_layout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
_layout.setRefreshing(true);
|
||||
contactInfos.setVisibility(View.INVISIBLE);
|
||||
contactProgressBar.setVisibility(View.VISIBLE);
|
||||
(new Handler()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
objects.clear();
|
||||
adapter.notifyDataSetChanged();
|
||||
new ContactLoadTask(element, getBaseContext(), adapter, objects, _layout, contactProgressBar, contactInfos).execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
mLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
mLayout.setRefreshing(true);
|
||||
mContactInfos.setVisibility(View.INVISIBLE);
|
||||
contactProgressBar.setVisibility(View.VISIBLE);
|
||||
(new Handler()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mObjects.clear();
|
||||
mAdapter.notifyDataSetChanged();
|
||||
new ContactLoadTask(element, getBaseContext(), mAdapter, mObjects, mLayout, contactProgressBar, mContactInfos).execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchContact(String name) {
|
||||
|
||||
if (!PermissionChecker.checkPermission(this, Manifest.permission.READ_CONTACTS,
|
||||
REQUEST_CONTACTS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
|
||||
null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " = ?",
|
||||
new String[]{name}, null);
|
||||
if (people == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
people.moveToFirst();
|
||||
|
||||
Vector<String> r = new Vector<>();
|
||||
if (people.getCount() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String contactId = people.getString(people.getColumnIndex(ContactsContract.Contacts._ID));
|
||||
|
||||
if ("1".equalsIgnoreCase(people.getString(people.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)))) {
|
||||
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
|
||||
null,
|
||||
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
|
||||
new String[]{contactId}, null);
|
||||
|
||||
while ((phones != null) && phones.moveToNext()) {
|
||||
r.add(phones.getString(phones.getColumnIndex(
|
||||
ContactsContract.CommonDataKinds.Phone.NUMBER))
|
||||
.replaceAll(" ", ""));
|
||||
}
|
||||
|
||||
if (phones != null) {
|
||||
phones.close();
|
||||
}
|
||||
}
|
||||
|
||||
Integer smsCount = 0;
|
||||
// @TODO asynctask to load more datas
|
||||
|
||||
if (!r.isEmpty()) {
|
||||
for (String pn: r) {
|
||||
mContactPhoneListAdapter.add(pn);
|
||||
}
|
||||
} else {
|
||||
mContactPhoneListAdapter.add(mFetchedContact);
|
||||
}
|
||||
|
||||
mContactInfos.setVisibility(View.VISIBLE);
|
||||
mContactPhoneListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/*
|
||||
* Permissions
|
||||
*/
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
PermissionID requestCodeID = REQUEST_MAX;
|
||||
if ((requestCode > 0) || (requestCode < REQUEST_MAX.ordinal())) {
|
||||
requestCodeID = PermissionID.values()[requestCode];
|
||||
}
|
||||
switch (requestCodeID) {
|
||||
case REQUEST_CONTACTS:
|
||||
for (int grantResult : grantResults) {
|
||||
Log.d("OcSMS", Integer.toString(grantResult));
|
||||
}
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
fetchContact(mFetchedContact);
|
||||
} else {
|
||||
// Permission Denied
|
||||
Toast.makeText(this, getString(R.string.err_cannot_read_contacts) + " " +
|
||||
getString(R.string.please_fix_it), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ package fr.unix_experience.owncloud_sms.broadcast_receivers;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import android.Manifest;
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
@ -32,7 +33,9 @@ import fr.unix_experience.owncloud_sms.R;
|
||||
import fr.unix_experience.owncloud_sms.engine.ASyncSMSSync;
|
||||
import fr.unix_experience.owncloud_sms.engine.ConnectivityMonitor;
|
||||
import fr.unix_experience.owncloud_sms.engine.SmsFetcher;
|
||||
import fr.unix_experience.owncloud_sms.enums.PermissionID;
|
||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||
import fr.unix_experience.owncloud_sms.prefs.PermissionChecker;
|
||||
|
||||
public class ConnectivityChanged extends BroadcastReceiver implements ASyncSMSSync {
|
||||
|
||||
@ -58,6 +61,12 @@ public class ConnectivityChanged extends BroadcastReceiver implements ASyncSMSSy
|
||||
if (cMon.isValid() && !ConnectivityChanged.dataConnectionAvailable) {
|
||||
ConnectivityChanged.dataConnectionAvailable = true;
|
||||
Log.d(ConnectivityChanged.TAG,"ConnectivityChanged.onReceive, data conn available");
|
||||
|
||||
if (!PermissionChecker.checkPermission(context, Manifest.permission.READ_SMS,
|
||||
PermissionID.REQUEST_SMS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
checkMessagesAndSend(context);
|
||||
}
|
||||
// No data available and previous dataConnectionState was true
|
||||
@ -68,7 +77,6 @@ public class ConnectivityChanged extends BroadcastReceiver implements ASyncSMSSy
|
||||
}
|
||||
|
||||
private void checkMessagesAndSend(Context context) {
|
||||
|
||||
// Get last message synced from preferences
|
||||
Long lastMessageSynced = (new OCSMSSharedPrefs(context)).getLastMessageDate();
|
||||
Log.d(ConnectivityChanged.TAG,"Synced Last:" + lastMessageSynced);
|
||||
|
@ -21,4 +21,5 @@ public enum OCSMSNotificationType {
|
||||
SYNC,
|
||||
SYNC_FAILED,
|
||||
DEBUG,
|
||||
PERMISSION,
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ package fr.unix_experience.owncloud_sms.observers;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import android.Manifest;
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.Context;
|
||||
@ -32,6 +33,8 @@ import fr.unix_experience.owncloud_sms.engine.ConnectivityMonitor;
|
||||
import fr.unix_experience.owncloud_sms.engine.OCSMSOwnCloudClient;
|
||||
import fr.unix_experience.owncloud_sms.engine.SmsFetcher;
|
||||
import fr.unix_experience.owncloud_sms.enums.MailboxID;
|
||||
import fr.unix_experience.owncloud_sms.enums.PermissionID;
|
||||
import fr.unix_experience.owncloud_sms.prefs.PermissionChecker;
|
||||
|
||||
public class SmsObserver extends ContentObserver implements ASyncSMSSync {
|
||||
|
||||
@ -41,6 +44,11 @@ public class SmsObserver extends ContentObserver implements ASyncSMSSync {
|
||||
}
|
||||
|
||||
public void onChange(boolean selfChange) {
|
||||
if (!PermissionChecker.checkPermission(_context, Manifest.permission.READ_SMS,
|
||||
PermissionID.REQUEST_SMS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.onChange(selfChange);
|
||||
Log.d(SmsObserver.TAG, "onChange SmsObserver");
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
||||
android:id="@+id/nav_manage"
|
||||
android:icon="@drawable/ic_menu_manage"
|
||||
android:title="@string/action_settings"/>
|
||||
<item
|
||||
android:id="@+id/nav_appinfo_perms"
|
||||
android:icon="@drawable/ic_menu_manage"
|
||||
android:title="@string/action_appinfo_perms"/>
|
||||
</group>
|
||||
|
||||
<item android:title="@string/communicate">
|
||||
|
@ -160,5 +160,13 @@
|
||||
<string name="communicate">Communicate</string>
|
||||
<string name="ma_title_my_accounts">My accounts</string>
|
||||
<string name="ma_content_swipeaction">Swipe from left to right to access to action menu.</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="understood">Understood</string>
|
||||
<string name="notif_permission_required">Permissions required</string>
|
||||
<string name="notif_permission_required_content">Some permissions are missing to perform the sync process. Please fix it in app settings</string>
|
||||
<string name="please_fix_it">Please fix it.</string>
|
||||
<string name="err_cannot_read_contacts">We cannot read your contacts.</string>
|
||||
<string name="err_cannot_read_sms">We cannot read your SMS.</string>
|
||||
<string name="action_appinfo_perms">App Infos and permissions</string>
|
||||
|
||||
</resources>
|
||||
|
@ -91,4 +91,5 @@
|
||||
<string name="sync_title">Proceso de sincronización</string>
|
||||
<string name="sync_inprogress">Sincronización en progreso...</string>
|
||||
<string name="fatal_error">Error Fatal ! </string>
|
||||
<string name="understood"></string>
|
||||
</resources>
|
||||
|
@ -145,4 +145,12 @@
|
||||
<string name="communicate">Parlez de nous</string>
|
||||
<string name="ma_title_my_accounts">Mes comptes</string>
|
||||
<string name="ma_content_swipeaction">Glissez votre doigt de gauche à droite pour afficher le menu.</string>
|
||||
<string name="cancel">Annuler</string>
|
||||
<string name="understood">J\'ai compris</string>
|
||||
<string name="notif_permission_required">Permissions requises</string>
|
||||
<string name="notif_permission_required_content">Certaines permissions essentielles sont manquantes, merci de les corriger dans les paramètres de l\'application.</string>
|
||||
<string name="please_fix_it">Merci de bien vouloir le corriger.</string>
|
||||
<string name="err_cannot_read_contacts">Nous ne pouvons lire vos contacts.</string>
|
||||
<string name="err_cannot_read_sms">Nous ne pouvons pas lire vos SMS.</string>
|
||||
<string name="action_appinfo_perms">Infos et permissions</string>
|
||||
</resources>
|
||||
|
@ -195,4 +195,12 @@
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="ma_title_my_accounts">My accounts</string>
|
||||
<string name="ma_content_swipeaction">Swipe from left to right to access to action menu.</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="understood">Understood</string>
|
||||
<string name="notif_permission_required">Permissions required</string>
|
||||
<string name="notif_permission_required_content">Some permissions are missing to perform the sync process. Please fix it in app settings</string>
|
||||
<string name="please_fix_it">Please fix it.</string>
|
||||
<string name="err_cannot_read_contacts">We cannot read your contacts.</string>
|
||||
<string name="err_cannot_read_sms">We cannot read your SMS.</string>
|
||||
<string name="action_appinfo_perms">App Infos and permissions</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user