Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 26ba0b7

Browse files
author
Irvine Sunday
committed
Implementing the manifest class and interface
1 parent 92d0cce commit 26ba0b7

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
package com.microsoft.graph.connect.util;
22

3+
import java.util.HashMap;
4+
35
public interface IManifestReader {
6+
String getApplicationMetadataValueString(String key);
7+
int getApplicationMetadataValueInt(String key);
8+
boolean getApplicationMetadataValueBoolean(String key);
9+
int getApplicationMetadataValueColor(String key);
10+
float getApplicationMetadataValueFloat(String key);
11+
String getIntentFilterAction(String activityName);
12+
String[] getIntentFilterCategories(String activityName);
13+
HashMap<String, String> getIntentFilterData(String activityName);
14+
415
}
16+
Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,77 @@
11
package com.microsoft.graph.connect.util;
22

3-
public class ManifestReader {
3+
4+
import android.content.pm.PackageInfo;
5+
import android.content.pm.PackageManager;
6+
import android.os.Bundle;
7+
8+
import com.microsoft.graph.connect.Connect;
9+
10+
import java.util.HashMap;
11+
12+
/*
13+
Contains methods that access the application manifest
14+
*/
15+
public class ManifestReader implements IManifestReader{
16+
17+
/**
18+
* Gets the value of an AndroidManifest meta-data node. If the node value cannot be cast to String,
19+
* null is returned.
20+
* @param key String. The meta-data key value
21+
* @return String. The value associated with the key
22+
*/
23+
@Override
24+
public String getApplicationMetadataValueString(String key) {
25+
String returnValue = "";
26+
try {
27+
PackageInfo info = Connect.getContext().getPackageManager().getPackageInfo(
28+
Connect.getContext().getPackageName(),
29+
PackageManager.GET_META_DATA);
30+
if (info.applicationInfo.metaData != null) {
31+
Bundle bundle = info.applicationInfo.metaData;
32+
returnValue = bundle.getString(key);
33+
}
34+
} catch (Exception e) {
35+
e.printStackTrace();
36+
}
37+
return returnValue;
38+
}
39+
40+
@Override
41+
public int getApplicationMetadataValueInt(String key) {
42+
return 0;
43+
}
44+
45+
@Override
46+
public boolean getApplicationMetadataValueBoolean(String key) {
47+
return false;
48+
}
49+
50+
@Override
51+
public int getApplicationMetadataValueColor(String key) {
52+
return 0;
53+
}
54+
55+
@Override
56+
public float getApplicationMetadataValueFloat(String key) {
57+
return 0;
58+
}
59+
60+
@Override
61+
public String getIntentFilterAction(String activityName) {
62+
return null;
63+
}
64+
65+
@Override
66+
public String[] getIntentFilterCategories(String activityName) {
67+
return new String[0];
68+
}
69+
70+
@Override
71+
public HashMap<String, String> getIntentFilterData(String activityName) {
72+
return null;
73+
}
74+
75+
476
}
77+

0 commit comments

Comments
 (0)