summaryrefslogtreecommitdiffstats
path: root/Android/03-Permissions
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-02-11 22:29:54 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-11-10 17:40:54 +0100
commitf14e5dbbdf84a5bc068e3a1cfd104e876dd6da61 (patch)
tree606e3706475813843b5fa3b031ed52a5a583169e /Android/03-Permissions
parentc885a3c127a9ab64fad5535b6c1f9e42e4689f7b (diff)
downloadcoursera-f14e5dbbdf84a5bc068e3a1cfd104e876dd6da61.zip
coursera-f14e5dbbdf84a5bc068e3a1cfd104e876dd6da61.tar.gz
Android : 03-Permissions: implement
Diffstat (limited to 'Android/03-Permissions')
-rw-r--r--Android/03-Permissions/DangerousApp/AndroidManifest.xml25
-rw-r--r--Android/03-Permissions/PermissionsLab/AndroidManifest.xml3
-rw-r--r--Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/ActivityLoaderActivity.java3
-rw-r--r--Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/BookmarksActivity.java3
4 files changed, 17 insertions, 17 deletions
diff --git a/Android/03-Permissions/DangerousApp/AndroidManifest.xml b/Android/03-Permissions/DangerousApp/AndroidManifest.xml
index c9283a5..448a602 100644
--- a/Android/03-Permissions/DangerousApp/AndroidManifest.xml
+++ b/Android/03-Permissions/DangerousApp/AndroidManifest.xml
@@ -8,30 +8,27 @@
android:minSdkVersion="13"
android:targetSdkVersion="18" />
- <!--
- TODO - Using a permission element,
- define a custom permission with name
- "course.labs.permissions.DANGEROUS_ACTIVITY_PERM"
- and "dangerous" protection level.
- -->
+ <permission
+ android:name="course.labs.dangerousapp.DANGEROUS_ACTIVITY_PERM"
+ android:protectionLevel="dangerous"
+ />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <!-- TODO - enforce the custom permission on this Activity -->
+ android:theme="@style/AppTheme"
+ android:permission="course.labs.dangerousapp.DANGEROUS_ACTIVITY_PERM"
+ >
<activity
android:name=".DangerousActivity"
android:label="@string/app_name" >
- <!--
- TODO - add additional intent filter info so that this Activity
- will respond to an Implicit Intent with the action
- "course.labs.permissions.DANGEROUS_ACTIVITY"
- -->
-
+ <intent-filter>
+ <action android:name="course.labs.dangerousapp.DANGEROUS_ACTIVITY"/>
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/Android/03-Permissions/PermissionsLab/AndroidManifest.xml b/Android/03-Permissions/PermissionsLab/AndroidManifest.xml
index ce91e0a..b2b4f1d 100644
--- a/Android/03-Permissions/PermissionsLab/AndroidManifest.xml
+++ b/Android/03-Permissions/PermissionsLab/AndroidManifest.xml
@@ -3,7 +3,8 @@
package="course.labs.permissionslab"
android:versionCode="1"
android:versionName="1.0">
- <!-- TODO - add uses-permission elements -->
+ <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
+ <uses-permission android:name="course.labs.dangerousapp.DANGEROUS_ACTIVITY_PERM" />
<application
android:allowBackup="true"
diff --git a/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/ActivityLoaderActivity.java b/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/ActivityLoaderActivity.java
index eca3506..8219b58 100644
--- a/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/ActivityLoaderActivity.java
+++ b/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/ActivityLoaderActivity.java
@@ -28,6 +28,7 @@ public class ActivityLoaderActivity extends Activity {
private void startBookMarksActivity() {
Log.i(TAG, "Entered startBookMarksActivity()");
- // TODO - Start the BookmarksActivity
+ Intent intent = new Intent(ActivityLoaderActivity.this, BookmarksActivity.class);
+ startActivity(intent);
}
}
diff --git a/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/BookmarksActivity.java b/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/BookmarksActivity.java
index 6f4ae7e..1b1c348 100644
--- a/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/BookmarksActivity.java
+++ b/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/BookmarksActivity.java
@@ -68,6 +68,7 @@ public class BookmarksActivity extends Activity {
private void startGoToDangerousActivity() {
Log.i(TAG, "Entered startGoToDangerousActivity()");
- // TODO - Start the GoToDangerousActivity
+ Intent intent = new Intent(BookmarksActivity.this, GoToDangerousActivity.class);
+ startActivity(intent);
}
}