updates 6.1.0

Add full support activityForResult, sendBroadcast and RegisterReceiver.
Add types of extras.
This commit is contained in:
lampaa
2018-05-16 15:45:28 +03:00
parent 42fa26a8fb
commit b41e64026a
5 changed files with 241 additions and 210 deletions
+58
View File
@@ -0,0 +1,58 @@
package com.lampa.startapp;
import android.content.Intent;
import android.util.Log;
import org.apache.cordova.CordovaPlugin;
import java.lang.reflect.Field;
/**
* Created by User on 16.05.2018.
*/
public class Assets extends CordovaPlugin {
protected static final String TAG = "startApp";
protected boolean NO_PARSE_INTENT_VALS = false;
/**
* functions
*/
protected String parseExtraName(String extraName) {
String parseIntentExtra = extraName;
try {
parseIntentExtra = getIntentValueString(extraName);
}
catch(NoSuchFieldException e) {
parseIntentExtra = extraName;
}
catch(IllegalAccessException e) {
e.printStackTrace();
return extraName;
}
Log.e(TAG, parseIntentExtra);
return parseIntentExtra;
}
protected String getIntentValueString(String flag) throws NoSuchFieldException, IllegalAccessException {
if(NO_PARSE_INTENT_VALS) {
return flag;
}
Field field = Intent.class.getDeclaredField(flag);
field.setAccessible(true);
return (String) field.get(null);
}
protected int getIntentValue(String flag) throws NoSuchFieldException, IllegalAccessException {
Field field = Intent.class.getDeclaredField(flag);
field.setAccessible(true);
return field.getInt(null);
}
}