Skip to content

Commit

Permalink
Start scheduled service every hour (instead of daily) to better suppo…
Browse files Browse the repository at this point in the history
…rt hourly schedules - related codinguser#625

Remove WRITE_EXTERNAL_STORAGE declaration. No longer needed since minimum API level is now 19
  • Loading branch information
codinguser committed Apr 20, 2017
1 parent 97eb433 commit 83c5b92
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
12 changes: 5 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,17 @@
android:protectionLevel="dangerous" />

<uses-permission android:label="@string/label_permission_record_transactions"
android:name="org.gnucash.android.permission.RECORD_TRANSACTION" />
android:name="org.gnucash.android.permission.RECORD_TRANSACTION" />
<uses-permission android:label="@string/label_permission_create_accounts"
android:name="org.gnucash.android.permission.CREATE_ACCOUNT" />
<uses-permission android:label="@string/permission_access_sdcard"
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18"/>
android:name="org.gnucash.android.permission.CREATE_ACCOUNT" />

<uses-permission android:name="android.permission.VIBRATE"
android:label="Allow device to vibrate with notifications" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"
android:label="Schedule repeating transactions when device is rebooted"/>
android:label="Schedule repeating transactions when device is rebooted"/>
<uses-permission android:name="android.permission.INTERNET"
android:label="Export and backup to 3rd party hosting services" />
android:label="Export and backup to 3rd party hosting services" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application android:name="org.gnucash.android.app.GnuCashApplication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.gnucash.android.R;
import org.gnucash.android.db.BookDbHelper;
import org.gnucash.android.db.DatabaseHelper;
import org.gnucash.android.db.MigrationHelper;
import org.gnucash.android.db.adapter.AccountsDbAdapter;
import org.gnucash.android.db.adapter.BooksDbAdapter;
import org.gnucash.android.db.adapter.BudgetAmountsDbAdapter;
Expand Down Expand Up @@ -357,7 +356,7 @@ public static void startScheduledActionExecutionService(Context context){
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_FIFTEEN_MINUTES,
AlarmManager.INTERVAL_HALF_DAY, pendingIntent);
AlarmManager.INTERVAL_HOUR, pendingIntent);

context.startService(alarmIntent); //run the service the first time
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.LayoutRes;
Expand Down Expand Up @@ -233,18 +232,13 @@ protected void updateActiveBookName(){
protected void onDrawerMenuItemClicked(int itemId) {
switch (itemId){
case R.id.nav_item_open: { //Open... files
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
//use the storage access framework
Intent openDocument = new Intent(Intent.ACTION_OPEN_DOCUMENT);
openDocument.addCategory(Intent.CATEGORY_OPENABLE);
openDocument.setType("text/*|application/*");
String[] mimeTypes = {"text/*", "application/*"};
openDocument.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
startActivityForResult(openDocument, REQUEST_OPEN_DOCUMENT);

} else {
AccountsActivity.startXmlFileChooser(this);
}
//use the storage access framework
Intent openDocument = new Intent(Intent.ACTION_OPEN_DOCUMENT);
openDocument.addCategory(Intent.CATEGORY_OPENABLE);
openDocument.setType("text/*|application/*");
String[] mimeTypes = {"text/*", "application/*"};
openDocument.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
startActivityForResult(openDocument, REQUEST_OPEN_DOCUMENT);
}
break;

Expand Down

0 comments on commit 83c5b92

Please sign in to comment.